[Issue 4094] ICE(expression.c): recursive struct templates with type inference

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 20 01:33:30 PDT 2010


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


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

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


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2010-04-20 01:33:24 PDT ---
mtype.c, TypeStruct::dotExp line 6645. Should not be able to declare a variable
in terms of itself. This can be detected via the 'inuse' member of the
VarDeclaration. Something I don't really like about this is that it introduces
a long-range coupling into the code (the 'inuse' member is not well documented,
and it's also used for a completely different purpose in toDecoBuffer()).

Note that this patch also fixes bug 4093, and various other kinds of recursive
definitions (the existing cases which don't ICE just loop until the stack
overflow probe catches them, generating a "recursive template definition" error
message).

===

    if (v && !v->isDataseg())
    {

        Expression *ei = v->getConstInitializer();
        if (ei)
        {   e = ei->copy();     // need to copy it if it's a StringExp
+            if (v->inuse)
+            {
+                v->error("recursive declaration");
+                return new ErrorExp();
+            }
            e = e->semantic(sc);
            return e;
        }
    }

-- 
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