Comment #0 by alexander.breckel — 2012-02-25T06:44:17Z
The following code results in a CTFE error. The bad line is "array_of_tuples ~= Tuple!(int, int)(0, 0);"
import std.typecons;
void function_evaluated_at_compiletime() {
Tuple!(int, int)[] array_of_tuples;
array_of_tuples ~= Tuple!(int, int)(0, 0);
}
void main() {
mixin(function_evaluated_at_compiletime());
}
$ dmd main.d
dmd: interpret.c:94: Expression* CtfeStack::getValue(VarDeclaration*): Assertion `v->ctfeAdrOnStack >= 0 && v->ctfeAdrOnStack < stackPointer()' failed.
Aborted
DMD64 D Compiler v2.058
Comment #1 by clugdbug — 2012-02-27T12:22:32Z
Reduced test case. Seems to be very complicated.
----------------
template Tup7583(E...) { alias E Tup7583; }
struct S7583
{
Tup7583!(float, char) field;
alias field this;
this(int x) { }
}
int bug7583() {
S7583[] arr;
arr ~= S7583(0);
return 1;
}
static assert (bug7583());
Comment #2 by clugdbug — 2012-02-28T01:41:17Z
This is a front-end bug. Happens with == as well as ~=.
The front-end creates a temporary tuple variable __tup5.
Somehow the declaration of __tup5 gets removed. The ICE is because it's used before being declared.
Comment #3 by github-bugzilla — 2012-02-29T23:58:47Z