Bug 1144 – ICE(template.c) template mixin causes DMD crash

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-04-14T13:40:00Z
Last change time
2014-04-18T09:12:04Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
CppCoder

Comments

Comment #0 by CppCoder — 2007-04-14T13:40:18Z
template testHelper( A ... ) { char []testHelper() { char []result; foreach( t; a ) { result ~= "int " ~ t ~ ";\r\n"; } return result; } } template test( A ... ) { const char []test = testHelper( A ); } int main( char [][]args ) { mixin( test!( "hello", "world" ) ); return 0; }
Comment #1 by thomas-dloop — 2007-04-23T12:56:33Z
Comment #2 by bugzilla — 2007-04-27T14:57:11Z
Fixed DMD 1.014
Comment #3 by clugdbug — 2009-04-19T03:36:25Z
This is fixed in DMD2.028 but not in 1.042. Assertion failure: 'i < parameters->dim' on line 806 in file 'template.c'
Comment #4 by clugdbug — 2009-09-12T11:58:52Z
This is the test case which is failing in dstress: char[] testHelper(A ...)(){ char[] result; foreach(t; a){ result ~= "int " ~ t ~ ";\n"; } return result; } int main(){ mixin( testHelper!( "hello", "world" )() ); return 0; } Note that in the foreach(), it's 'a' instead of 'A'. So it's a bad test, which is actually an instance of bug 2229 (which I've just patched). The bug here was indeed fixed in 1.014.
Comment #5 by robert — 2009-11-07T07:52:58Z
The dstress test is failing again in dmd 1051: dmd: template.c:4017: Identifier* TemplateInstance::genIdent(): Assertion `0' failed. That DStress case is correct, it's in nocompile/, so shouldn't compile.
Comment #6 by robert — 2009-11-07T07:54:22Z
*** Issue 3482 has been marked as a duplicate of this issue. ***
Comment #7 by clugdbug — 2009-11-07T14:49:53Z
(In reply to comment #5) > The dstress test is failing again in dmd 1051: > dmd: template.c:4017: Identifier* TemplateInstance::genIdent(): Assertion `0' > failed. > > That DStress case is correct, it's in nocompile/, so shouldn't compile. Yes, but it's testing bug 2229, not the one which was originally reported here. I'm closing this one, and re-opening the other. BTW it's not a regression. Bug 2229 was never fixed properly.