View mode: basic / threaded / horizontal-split · Log in · Help
June 30, 2011
[Issue 5889] Struct literal/construction should be rvalue
http://d.puremagic.com/issues/show_bug.cgi?id=5889



--- Comment #10 from Kenji Hara <k.hara.pg@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: -------
June 30, 2011
[Issue 5889] Struct literal/construction should be rvalue
http://d.puremagic.com/issues/show_bug.cgi?id=5889



--- Comment #11 from Kenji Hara <k.hara.pg@gmail.com> 2011-06-30 04:47:55 PDT ---
Another example.
In C++0x (gcc-4.5.1), following code prints "1".
It seems to me that the S() makes rvalue instead of lvalue.
----
#include <stdio.h>

struct S {};

int f(S&&){ return 1; }
int f(const S&){ return 2; }

int main()
{
 printf("%d\n", f(S()));
 return 0;
}
----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 13, 2011
[Issue 5889] Struct literal/construction should be rvalue
http://d.puremagic.com/issues/show_bug.cgi?id=5889


Kenji Hara <k.hara.pg@gmail.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
                CC|                            |andrei@metalanguage.com


--- Comment #12 from Kenji Hara <k.hara.pg@gmail.com> 2011-12-12 19:55:11 PST ---
*** Issue 7100 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 31, 2012
[Issue 5889] Struct literal/construction should be rvalue (it binds to ref parameters)
http://d.puremagic.com/issues/show_bug.cgi?id=5889



--- Comment #13 from yebblies <yebblies@gmail.com> 2012-01-31 14:36:09 EST ---
*** Issue 5178 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 21, 2012
[Issue 5889] Struct literal/construction should be rvalue (it binds to ref parameters)
http://d.puremagic.com/issues/show_bug.cgi?id=5889



--- Comment #14 from github-bugzilla@puremagic.com 2012-02-20 19:22:11 PST ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/907c94de34b9d99438e7e244c556903224a0c094
Merge pull request #41 from 9rnsr/rvalue-struct-literal

Issue 5889 - Struct literal/construction should be rvalue

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 21, 2012
[Issue 5889] Struct literal/construction should be rvalue (it binds to ref parameters)
http://d.puremagic.com/issues/show_bug.cgi?id=5889


Walter Bright <bugzilla@digitalmars.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
            Status|NEW                         |RESOLVED
        Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 22, 2012
[Issue 5889] Struct literal/construction should be rvalue (it binds to ref parameters)
http://d.puremagic.com/issues/show_bug.cgi?id=5889


Kenji Hara <k.hara.pg@gmail.com> changed:

          What    |Removed                     |Added
----------------------------------------------------------------------------
                CC|                            |dsimcha@yahoo.com


--- Comment #15 from Kenji Hara <k.hara.pg@gmail.com> 2012-04-22 16:38:58 PDT ---
*** Issue 4843 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 23, 2012
[Issue 5889] Struct literal/construction should be rvalue (it binds to ref parameters)
http://d.puremagic.com/issues/show_bug.cgi?id=5889



--- Comment #16 from Kenji Hara <k.hara.pg@gmail.com> 2012-04-23 11:18:45 PDT ---
*** Issue 5769 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Next ›   Last »
1 2
Top | Discussion index | About this forum | D home