Rvalue references - The resolution

Steven Schveighoffer schveiguy at yahoo.com
Mon May 6 10:45:35 PDT 2013


On Mon, 06 May 2013 13:28:18 -0400, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 5/6/13 12:17 PM, Steven Schveighoffer wrote:
>> On Mon, 06 May 2013 12:03:27 -0400, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> wrote:
>>> No. It's a very different thing handled by a special rule in C++.
>>
>> This isn't helping. You keep saying its different but not how.
>
> In one case a reference is returned, in the other an rvalue is returned.

This is a trimmed down example:

int &foo(int &val) { return val; }

What I read from you (and I could be wrong) is you are saying this is not  
valid:

foo(foo(foo(1)));

Is that right?

>
>>> Yes. My point was to illustrate that a special rule that works in a
>>> situation can't help another.
>>
>> Another situation that's already solved? Don't see the point.
>
> No. That situation leads to undefined behavior.

In D that situation is invalid.  You can't have ref members.

-Steve


More information about the Digitalmars-d mailing list