Bug 1414 – compiler crashes with CTFE and structs

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2007-08-12T03:35:00Z
Last change time
2014-02-16T15:22:09Z
Assigned to
bugzilla
Creator
dlang-bugzilla

Comments

Comment #0 by dlang-bugzilla — 2007-08-12T03:35:54Z
---------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
Comment #1 by bugzilla — 2007-09-28T22:10:26Z
Fixed dmd 1.021 and 2.004