Thread overview
[Issue 1363] New: Compile-time issue with structs in 'for'
Jul 23, 2007
d-bugmail
Jul 23, 2007
d-bugmail
Sep 29, 2007
d-bugmail
July 23, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1363

           Summary: Compile-time issue with structs in 'for'
           Product: D
           Version: 1.019
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: samukha@voliacable.com


Related to 1300.

struct Bar
{
    int x;
}

int foo()
{
    Bar bar;

    // Error: cannot evaluate foo() at compile time
    for (bar.x = 0; bar.x < 10; bar.x++)
    {
    }

    return bar.x;
}

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


-- 

July 23, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1363





------- Comment #1 from samukha@voliacable.com  2007-07-23 03:39 -------
This one gives
'Error: cannot cast int to char[]':

struct Bar
{
    int x;
    char[] s;
}

char[] foo()
{
    Bar bar; // Works if bar is explicitly initialized.
    return bar.s;
}

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


-- 

September 29, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1363


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from bugzilla@digitalmars.com  2007-09-28 22:07 -------
Fixed dmd 1.021 and 2.004


--