[Issue 3167] Passing result of a function call as ref argument no longer works

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 6 06:40:57 PDT 2009


Bill Baxter <wbaxter at gmail.com> changed:

           What    |Removed                     |Added
                 CC|                            |wbaxter at gmail.com

--- Comment #5 from Bill Baxter <wbaxter at gmail.com>  2009-08-06 06:40:55 PDT ---
(In reply to comment #3)
> I'm fairly sure this was by design (bug 2621) in D 2.026, but I don't think it
> was expected to seep through to D1.

I hope you're right.  
In D2 you can have the ref argument be const (which I hope eliminates the
error), but in D1 you have no such option.  So you often have to resort to
making arguments 'ref' for efficiency even when the function doesn't modify the

Also the error message could be a little clearer.  Something like "Can't pass a
temporary to a function taking a ref argument" would be a lot clearer I think. 
Passing something to a function taking a ref does not necessarily imply
assigning to that ref argument in D1, for the reason stated above.

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