Bug 12499 – tuple/TypeTuple 1-Arg initialization fails during CTFE.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-31T07:24:00Z
Last change time
2014-04-07T15:42:27Z
Keywords
CTFE, pull, rejects-valid
Assigned to
nobody
Creator
monarchdodra
Comments
Comment #0 by monarchdodra — 2014-03-31T07:24:35Z
I'm not sure how "legal" this kind of initialization is to begin with (see:
https://d.puremagic.com/issues/show_bug.cgi?id=6367
).
In any case, it fails during CTFE.
//----
auto foo()
{
//Initialize 3 ints to 5.
TypeTuple!(int, int, int) a = 5;
return a[0]; //Error: variable _a_field_0 cannot be read at compile time
}
void main()
{
auto a = foo(); //OK
enum b = foo(); //FAILS
}
//----