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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 12 08:40:28 PDT 2009


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

           Summary: Passing result of a function call as ref argument no
                    longer works
           Product: D
           Version: 1.046
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: nfxjfg at gmail.com


The following code works with dmd 1.045, but not with 1.046. It seems you can
no longer pass the result of a function call as argument to ref parameters.

While it's debatable if the old or new behavior is better, the chan ge breaks
existing code.

>>
struct X {
}

X i() {
    return X.init;
}

void foo(ref X x) {
}

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

This fails with
test.d(12): Error: cannot assign to function call

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