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

           Summary: [CTFE] Can't alter ref param taken from struct member
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: cbkbbej...@mailinator.com


--- Comment #0 from Nick Sabalausky <cbkbbej...@mailinator.com> 2012-01-10 
19:47:50 PST ---
-----------------------------------
import std.stdio;
struct S { int a; }

int foo()
{
    S s;
    return bar(s.a);  // A
    //bar(s.a); return s.a; // B
}

int bar(ref int b)
{
    b = 5;
    return b;
}

enum y = foo();

void main()
{
    writeln(y);
}
-----------------------------------

Expected output: 5
Actual output: 0

Same thing occurs with either the "// A" line or the "// B" line uncommented. 
Also occurs with "out" instead of "ref".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to