Bug 5242 – self referencing template constraint crashes compiler

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-11-19T14:30:00Z
Last change time
2010-12-22T23:38:47Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
michal.minich

Comments

Comment #0 by michal.minich — 2010-11-19T14:30:59Z
I wanted to restrict template parameter X to allow only derived classes of A. class A (X : A!(X)) { } class B : A!(B) { } void main () {}
Comment #1 by clugdbug — 2010-11-19T14:42:41Z
PATCH: template.c, line 2509 void deduceBaseClassParameters(BaseClass *b, Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes, Objects *best, int &numBaseClassMatches) { - TemplateInstance *parti = b->base->parent->isTemplateInstance(); + TemplateInstance *parti = b->base ? b->base->parent->isTemplateInstance() : NULL; if (parti) { // Make a temporary copy of dedtypes so we don't destroy it Objects *tmpdedtypes = new Objects();
Comment #2 by bugzilla — 2010-12-22T23:38:47Z