[Issue 1300] New: Issues with struct in compile-time function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 30 05:40:05 PDT 2007


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

           Summary: Issues with struct in compile-time function
           Product: D
           Version: 1.017
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: samukha at voliacable.com


May be related to 1204

struct Bar
{
    int x;
}

int foo()
{
    // Fails with 'Error: cannot cast int to Bar' if explicit initialization is
omitted:
    Bar b = Bar.init;

    b.x = 1;
    b = bar(b); // Error: cannot evaluate foo() at compile time

    return b.x;
}

Bar bar(Bar b)
{
    return b;
}

void main(char[][] args)
{
    static x = foo();
}


-- 



More information about the Digitalmars-d-bugs mailing list