[Issue 3996] Regression(2.041) ICE(glue.c) Passing struct as AA template parameter (Algebraic with struct)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 6 14:01:39 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3996


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #4 from Don <clugdbug at yahoo.com.au> 2010-09-06 14:01:17 PDT ---
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;
        }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list