const(Rvalue) resolved to different overloads
Ali Çehreli via Digitalmars-d
digitalmars-d at puremagic.com
Sat Dec 31 22:43:42 PST 2016
On 12/31/2016 09:18 PM, safety0ff wrote:
> On Thursday, 29 December 2016 at 22:54:35 UTC, Ali Çehreli wrote:
>>
>> Can you explain that behavior?
>
> What about: http://dlang.org/spec/const3.html#implicit_conversions
> "An expression may be converted from mutable or shared to immutable if
> the expression is unique and all expressions it transitively refers to
> are either unique or immutable."
Good find but its effect in overload resolution is an oversight.
The uniqueness of an expression should not interfere with overload
resolution because overload resolution does not involve expressions but
their types. Otherwise, a simple change in an object initialization
takes us to a different function. A different kind of hijacking indeed...
Ali
More information about the Digitalmars-d
mailing list