On Tue, 15 Oct 2024, 23:06 RazvanN via Digitalmars-d, <digitalmars-d@puremagic.com> wrote:
On Tuesday, 15 October 2024 at 12:56:35 UTC, RazvanN wrote:

>> Isn't this the exact moment that the recursion ends? If the
>> copy ctor was an exact match (we must have been supplied an
>> lvalue), and (therefore) while considering the move
>> constructor it was determined that a copy is necessary, then
>> it is not an exact match... copy ctor wins. Case closed.
>>

Note that today, from the compilers perspective both the move
ctor and
the copy ctor are exact matches. However, the compiler does a
thing called
partial ordering where it selects the function that is more
specialized.
This is where ref gets picked of rvalue because it is deemed more
specialized.

So, all you need to do is just tweak this and simply add a check
for the situation
where a copy constructor is preferred over the move constructor.

Okay, but again with the constructor; does that rule generalise to any regular function argument?