D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7100 - rvalue binds to ref argument
Summary: rvalue binds to ref argument
Status: RESOLVED DUPLICATE of issue 5889
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Mac OS X
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-12 15:42 UTC by Andrei Alexandrescu
Modified: 2011-12-12 19:55 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrei Alexandrescu 2011-12-12 15:42:36 UTC
I am sure this bug has been filed, but it doesn't have the right keywords so I couldn't find it. If anyone does, please make that a dupe of this.

struct abc
{
   ref abc opAssign(ref abc rhs)
   {
       writeln("opAssign");
       return this;
   }
}

void
main(string[] argv)
{
   abc x;
   x= abc();
}

The code shouldn't compile. I fished this one from a lost email from June 6, 2010.
Comment 1 Kenji Hara 2011-12-12 19:55:10 UTC
Current dmd implementation marks struct literal and construction as lvalue.

*** This issue has been marked as a duplicate of issue 5889 ***