C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Fwd: Extension to runtime polymorphism proposed

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 07 Apr 2026 20:09:05 -0700
On Tuesday, 7 April 2026 19:22:09 Pacific Daylight Time Muneem via Std-
Proposals wrote:
> No, I said it multiple times that T^ can decay into T& or T&& or even T if
> T^ overload doesn't exist.

What if it does? What if it does and the T&& doesn't? How about cv-qualifier
mismatches?

> You don't need that. The decaying priority list
> is as follows:
> If const lvalue overload is there then const lvalue, if lvalue overload
> then lvalue, if const lvalue reference overload then const lvalue, and so
> on (for rvalues as well). This priority list makes overloading for T^ fit
> right into the existing overloading rules, without having to make
> additional complicated overloading rules.

How about xvalues, where do they go?

The overloading rules are *already* complicated. There's no way you can add to
it without making it even more complicated. If you want to touch the
overloading rules *at all*, then you probably need to dedicate 5 years to this
project. I am not kidding or exaggerating.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-04-08 03:09:10