[Issue 1956] New: Struct in 'for' statement breaks CTFE

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 28 01:33:26 PDT 2008


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

           Summary: Struct in 'for' statement breaks CTFE
           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


Reopens 1363 (I messed up that one by posting two bugs in a single bug report)

----
struct S
{
    int x;
}

int foo()
{
    S s;
    for(; s.x < 10; s.x++)
    {
    }
    return s.x;
}

enum x = foo();
----
Error: cannot evaluate foo() at compile time (output twice)


-- 



More information about the Digitalmars-d-bugs mailing list