Bug 2309 – Crash on a template mixing in a variadic template with an undefined template identifier
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2008-08-23T12:22:00Z
Last change time
2014-03-01T00:36:33Z
Keywords
ice-on-invalid-code, patch
Assigned to
bugzilla
Creator
matti.niemenmaa+dbugzilla
Comments
Comment #0 by matti.niemenmaa+dbugzilla — 2008-08-23T12:22:18Z
template Id(xs...) { const Id = xs[0]; }
template Foo() { mixin Id!(NONEXISTENT!()); }
alias Foo!() x;
The above gives the following before crashing DMD:
foo.d(3): template instance identifier 'NONEXISTENT' is not defined
In the following case, no error message is given before the crash, which is why I'm marking this as major:
template Id(xs...) { const Id = xs[0]; }
template Foo() { mixin Id!(NONEXISTENT!()); }
// removing the 'int' here brings the error message back
template Bar(alias F) { const int Bar = F!(); }
alias Bar!(Foo) x;
Comment #1 by clugdbug — 2009-04-24T03:30:04Z
Here's a patch: This one is really simple.
--------------------
Index: mangle.c
===================================================================
--- mangle.c (revision 24)
+++ mangle.c (working copy)
@@ -217,7 +217,7 @@
printf("\n");
#endif
id = ident ? ident->toChars() : toChars();
- if (tempdecl->parent)
+ if (tempdecl && tempdecl->parent)
{
char *p = tempdecl->parent->mangle();
if (p[0] == '_' && p[1] == 'D')