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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 29 15:00:31 PST 2010


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


Eldar Insafutdinov <e.insafutdinov at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |e.insafutdinov at gmail.com


--- Comment #12 from Eldar Insafutdinov <e.insafutdinov at gmail.com> 2010-01-29 15:00:25 PST ---
(In reply to comment #10)
> I'm going to mark this as invalid, as function return values should be rvalues,
> and rvalues cannot be references, even if the vagaries of the implementation
> make that possible.
> 
> The reason is "vagaries of the implementation", so it may work on one
> implementation but not another. Currently, whether it (used to) work or not
> also depended on the contents of the struct being returned.

This test case fails for me with the latest dmd:

struct X {
}

X i() {
    return X.init;
}

void foo(const ref X x) {
}

void foo() {
    foo(i()); //line 12
}

This bug is not invalid.

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