Bug 1782 – Instantiating nested template with wrong instantiated parent template causes ICE

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2008-01-11T18:56:00Z
Last change time
2014-02-24T15:32:53Z
Keywords
ice-on-invalid-code
Assigned to
bugzilla
Creator
ary

Comments

Comment #0 by ary — 2008-01-11T18:56:27Z
When compiling the following code: --- template Foo(alias T) { template Temp() { const char[] Temp = "int x;"; } } mixin(Foo!(1).Temp!()); --- DMD says: one.d(7): template instance Foo!(1) does not match any template declaration and then comes the ICE.
Comment #1 by ary — 2008-01-11T19:10:47Z
I think the bug is in expression.c, line 5152: --- error("template identifier %s is not a member of %s %s", id->toChars(), s->kind(), s->ident->toChars()); --- In this case, s is an instance of TemplateInstance, and so s->ident is null. It should be replaced by: --- Identifier* id; if (s->isTemplateInstance()) { id = s->isTemplateInstance()->name; } else { id = s->ident; } error("template identifier %s is not a member of %s %s", id->toChars(), s->kind(), id->toChars()); --- Or something similar to that.
Comment #2 by clugdbug — 2009-05-13T12:52:14Z
Fixed DMD1.045. (was fixed in D2.027 or earlier)