digitalmars.D.bugs - [Issue 6200] New: [GSoC] Value returned by function cannot be passed as ref const.
- d-bugmail puremagic.com (28/28) Jun 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6200
- d-bugmail puremagic.com (13/13) Jun 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6200
- d-bugmail puremagic.com (8/13) Jun 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6200
- d-bugmail puremagic.com (8/17) Jun 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6200
- d-bugmail puremagic.com (13/26) Jun 23 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6200
http://d.puremagic.com/issues/show_bug.cgi?id=6200
Summary: [GSoC] Value returned by function cannot be passed as
ref const.
Product: D
Version: D2
Platform: All
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody puremagic.com
ReportedBy: cristi.cobzarenco gmail.com
12:23:27 PDT ---
struct Test {}
void takes( ref const Test x ) {}
Test gives() { return Test(); }
int main() {
takes( Test() ); // compiles
// takes( gives() ); // doesn't compile
readln();
return 0;
}
Is this required behaviour? The compiler complains about gives() not being an
lvalue, but the code doesn't seem to require it to be an lvalue.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 23 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6200
kennytm gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kennytm gmail.com
No 'ref' does require the parameter as an lvalue, even if 'const' is present.
This is different from C++. I think it's a duplicate of bug 3167.
Also, the struct literal 'Test()' currently returns an lvalue, not an rvalue.
See bug 5889.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 23 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6200 13:08:14 PDT ---No 'ref' does require the parameter as an lvalue, even if 'const' is present. This is different from C++. I think it's a duplicate of bug 3167. Also, the struct literal 'Test()' currently returns an lvalue, not an rvalue. See bug 5889.Aha, I guess you're right, I assumed that const would fix it (bug 3167 only talks about normal refs), 'in' works though. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 23 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6200Bug 3167 does talk about 'const ref' in the later comments, e.g. http://d.puremagic.com/issues/show_bug.cgi?id=3167#c12. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------No 'ref' does require the parameter as an lvalue, even if 'const' is present. This is different from C++. I think it's a duplicate of bug 3167. Also, the struct literal 'Test()' currently returns an lvalue, not an rvalue. See bug 5889.Aha, I guess you're right, I assumed that const would fix it (bug 3167 only talks about normal refs), 'in' works though.
Jun 23 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6200
Cristi Cobzarenco <cristi.cobzarenco gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
13:15:13 PDT ---
No 'ref' does require the parameter as an lvalue, even if 'const' is present.
This is different from C++. I think it's a duplicate of bug 3167.
Also, the struct literal 'Test()' currently returns an lvalue, not an rvalue.
See bug 5889.
Aha, I guess you're right, I assumed that const would fix it (bug 3167 only
talks about normal refs), 'in' works though.
Bug 3167 does talk about 'const ref' in the later comments, e.g.
http://d.puremagic.com/issues/show_bug.cgi?id=3167#c12.
You're right again, sorry. I looked through the comments, but somehow didn't
see that one. I'll mark this as invalid.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 23 2011









d-bugmail puremagic.com 