[Issue 1378] New: A function call in an array literal causes compiler to crash

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 26 05:31:36 PDT 2007


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

           Summary: A function call in an array literal causes compiler to
                    crash
           Product: D
           Version: 2.002
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: samukha at voliacable.com


dmd 2.003. It doesn't like the call to foo in the first element of the array
literal. 

string foo()
{
    return "";
}

string rod(string[] a)
{
    return a[0];
}

void main()
{
    static x = rod([foo(), ""]); // crash
}

Works, if the result of foo is put into a temporary:

string foo()
{
    return "";
}

string rod(string[] a)
{
    return a[0];
}

void main()
{
    const char[] temp = foo();
    static x = rod([temp, ""]); // ok
}


-- 



More information about the Digitalmars-d-bugs mailing list