Bug 3996 – Regression(2.041) ICE(glue.c) Passing struct as AA template parameter (Algebraic with struct)

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-03-21T06:51:00Z
Last change time
2014-02-15T02:42:25Z
Keywords
ice-on-valid-code, patch
Assigned to
nobody
Creator
michel.fortin

Comments

Comment #0 by michel.fortin — 2010-03-21T06:51:37Z
DMD 2.041 and 2.042 on Mac OS X crash with this input. It was working a few versions before, but I don't know exactly at which point it broke. import std.variant; struct A {} alias Algebraic!(A) sts;
Comment #1 by clugdbug — 2010-06-09T11:57:21Z
Reduced test case shows it's a regression from AAs becoming a library type. template ICE3996(T : V[K], K, V) {} struct Bug3996 {} static assert(!is( ICE3996!(Bug3996) ));
Comment #2 by clugdbug — 2010-06-15T07:21:22Z
I think the root cause of this is bug 4269.
Comment #3 by clugdbug — 2010-07-13T08:14:34Z
*** Issue 4449 has been marked as a duplicate of this issue. ***
Comment #4 by clugdbug — 2010-09-06T14:01:17Z
This turns out to be simple. When there's an error in the AA parameters, it should not continue to instantiate the template. There's no "error declaration", so return a struct of type TError. Not sure if it's OK to give it no name. (Would also be possible to return NULL in this case, but then everything that calls it would need to be changed, to prevent segfaults). PATCH(mtype.c): Line 3966 StructDeclaration *TypeAArray::getImpl() { // Do it lazily if (!impl) { Type *index = this->index; Type *next = this->next; if (index->reliesOnTident() || next->reliesOnTident()) { error(loc, "cannot create associative array %s", toChars()); index = terror; next = terror; + StructDeclaration *s = new StructDeclaration(0, NULL); + s->type = terror; + return s; }
Comment #5 by bugzilla — 2010-09-11T14:17:47Z