[Issue 5889] Struct literal/construction should be rvalue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 30 04:42:37 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5889



--- Comment #10 from Kenji Hara <k.hara.pg at gmail.com> 2011-06-30 04:37:33 PDT ---
OK. Here's another advantage of that.

----
struct S1{ int n; }
struct S2{ this(int n){} }
struct S3{ int n; void opAssign(S3 rhs){} }

void main()
{
    S1(0) = S1(0);  // Line 7
    S2(0) = S2(0);  // Line 8
    S3(0) = S3(0);  // Line 9 
}
----

Line 7 and 8 are no effect codes. We can reject them by making struct literal
as rvalue.
Line 9 is an exception. S3.opAssign can have effect, so it is legal.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list