2309 – Crash on a template mixing in a variadic template with an undefined template identifier

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2309 - Crash on a template mixing in a variadic template with an undefined template identifier
Summary: Crash on a template mixing in a variadic template with an undefined template ...
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 major
Assignee: Walter Bright
URL:
Keywords: ice-on-invalid-code, patch
Depends on:
Blocks:
Reported: 2008年08月23日 12:22 UTC by Matti Niemenmaa
Modified: 2014年03月01日 00:36 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Matti Niemenmaa 2008年08月23日 12:22:18 UTC
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 Don 2009年04月24日 03:30:04 UTC
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')
Comment 2 Don 2009年05月14日 07:28:50 UTC
Fixed DMD1.045 and 2.030


AltStyle によって変換されたページ (->オリジナル) /