[Issue 2427] New: Function call in struct initializer fails to compile

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 23 05:14:16 PDT 2008


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

           Summary: Function call in struct initializer fails to compile
           Product: D
           Version: 2.020
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: samukha at voliacable.com


Compiler tries to CTFE the function:

struct S
{
    int x;
}

int foo(int i)
{
    return i;
}

void main()
{
    int i;
    S s = { foo(i) };
    return 0;
}
----
test.d(20): Error: variable i is used before initialization


-- 



More information about the Digitalmars-d-bugs mailing list