Bug 1378 – A function call in an array literal causes compiler to crash
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2007-07-26T07:31:00Z
Last change time
2015-06-09T01:04:58Z
Keywords
ice-on-valid-code
Assigned to
bugzilla
Creator
samukha
Comments
Comment #0 by samukha — 2007-07-26T07:31:35Z
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
}