[Issue 1414] New: compiler crashes with CTFE and structs

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 12 01:35:55 PDT 2007


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

           Summary: compiler crashes with CTFE and structs
           Product: D
           Version: 1.019
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: thecybershadow at gmail.com


---------test case 1---------
struct MyStruct
{
        string name;
}

const MyStruct item = {"item"};

string mixItemList()
{
        return item.name;
}

const string s = mixItemList();
-------end test case 1-------

---------test case 2---------
struct MyStruct
{
        string name;
}

const MyStruct[] items = 
[
        {"item"},
];

string mixItemList()
{
        string s;
        foreach(item;items)
                s ~= item.name;
        return s;
}

const string s = mixItemList();
-------end test case 2-------

Both cases crash, case 2 also outputs a strange error message:
testcase2.d(7): Error: array initializers as expressions are not allowed


-- 



More information about the Digitalmars-d-bugs mailing list