Bug 8517 – ICE(toir.c 178) or stack overflow with recursive alias template

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-08-07T08:35:00Z
Last change time
2015-06-09T05:11:42Z
Keywords
ice
Assigned to
nobody
Creator
michal.minich

Comments

Comment #0 by michal.minich — 2012-08-07T08:35:47Z
dmd 2.060 void x1 () { y!(a => a)(); } void x2 () { y!(a => a)(); } void y (alias f) () { y!(a => a)(); } Comment out either x1 or x2 line and error disappears. This bug might be a duplicate of http://d.puremagic.com/issues/show_bug.cgi?id=8460 http://d.puremagic.com/issues/show_bug.cgi?id=8436 http://d.puremagic.com/issues/show_bug.cgi?id=7917 http://d.puremagic.com/issues/show_bug.cgi?id=6426 and maybe others
Comment #1 by clugdbug — 2012-11-14T23:53:57Z
Actually y!() is the problem, the other bit is just instantiating y. Also stack overflows on D1 and 2.057. The reason is, that the FQN of the delegate includes the FQN of the template. You can see this if you use .mangleof (uncomment the pragma). Simplified test case: void y (alias f) () { int delegate(int) qq; // pragma(msg, qq.mangleof); y!(qq)(); } void x1() { int q; y!(q)(); }
Comment #2 by bugzilla — 2013-10-03T18:03:52Z
With 2.064 head: Michal's example: test.d(1): Error: template instance test.x1.y!((a) => a) recursive expansion Don's example: test.d(7): Error: template instance test.x1.y!(q) recursive expansion Works on D1 1.077 too.