[Issue 1950] New: CTFE doesn't work correctly for structs passed by ref

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 26 14:52:58 PDT 2008


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

           Summary: CTFE doesn't work correctly for structs passed by ref
           Product: D
           Version: 2.012
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: samukha at voliacable.com


struct S
{
    int x;
}

int foo()
{
    S s;
    bar(s);
    return s.x;
}

void bar(ref S s)
{
    s.x = 10;
}

enum x = foo();
static assert(x == 10); // Fails, x is 0


-- 



More information about the Digitalmars-d-bugs mailing list