Bug 1214 – Using tuples to instanciate a delegate literal crashes compiler
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-05-05T23:06:00Z
Last change time
2014-02-16T15:23:32Z
Keywords
ice-on-valid-code
Assigned to
bugzilla
Creator
jrs7561
Comments
Comment #0 by jrs7561 — 2007-05-05T23:06:08Z
I'm pretty sure this should be legal,and if it's not it should definetly not crash dmd.
The following code generates a crash with the message, "Assertion failure 0 on line 710 in file 'glue.c'."
import std.stdio;
template Tuple(P...) {
alias P Tuple;
}
alias Tuple!(int) where_t;
alias bool delegate(where_t) dgt;
int main(char[][] args) {
doit((where_t j){ return(j[0] == 9); });
return 0;
}
void doit(dgt exp) {
for(int i = 0; i < 11; i++)
if(exp(i))
writefln("Success");
else
writefln("Failure");
}
Comment #1 by dhasenan — 2007-09-09T16:26:10Z
It seems that whenever I try to make progress on my Project Which Must Not Be Named, I find another one of these issues. In this case, in order to create a mock object, I need to create delegates based on the ReturnType and ParameterTypeTuple of a given function, and this prevents it.
Anyway, yes, a duplicate, though now in DMD2 it's moved to glue.c:717.
*** This bug has been marked as a duplicate of 854 ***