[Issue 6221] Should be possible to pass struct function returns by 'const ref'.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 29 08:00:10 PDT 2011


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


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com


--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-06-29 07:55:14 PDT ---
I think this bug is invalid.  A value-type return is an rvalue, and Andrei has
made it very clear in his posts and in TDPL that rvalues cannot be bound to
const ref parameters.  I think his reasoning is that this ability was a mistake
in C++, though I haven't gotten consistent answers as to why.

However, I cannot tell you what you are supposed to do -- I had thought that
auto ref was supposed to take care of this (i.e. you could bind an rvalue to an
auto ref parameter), but I've gotten mixed interpretations from Andrei on how
it is supposed to work.

The fact that it works with opCmp in one direction is I think a relaxation of
the rules, because struct returns would be near useless if you couldn't call
any methods on them.

I'll leave this up to Andrei or Walter to mark it invalid, in case I'm wrong.

-- 
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