Steven Schveighoffer <> changed:

           What    |Removed                     |Added
                 CC|                            |

--- Comment #14 from Steven Schveighoffer <> 2010-01-29 
19:24:11 PST ---
(In reply to comment #13)
> It is invalid code because you are taking a reference to the return value of a
> function. Functions return, by definition, rvalues. You cannot take a 
> reference
> to an rvalue.

This breaks custom types.  Who are you as the compiler to assume my type is an


class MyClass
   struct myForwardRange {...}
   @property myForwardRange all() {...}   

void copy(R1, R2)(ref R1 inputrange, ref R2 outputrange)

void foo(MyClass mc, OutputRange r)
   copy(mc.all, r);

Another case:

struct LargeStruct
  int[100] bigarray;
  void print(streamtype s) {s.print(bigarray);}

class X
  LargeStruct createalargestruct() {...}

void foo(X x)

Also, if you can't call properties on a struct, which essentially needs a
reference to the struct, then you can't get any properties from a returned

This rule is way too limiting.  at the very least, const rvalue references need
to be allowed for any reasonable value types that are not just POD to be

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to