www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4094] New: ICE(expression.c): recursive struct templates with type inference

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4094

           Summary: ICE(expression.c): recursive struct templates with
                    type inference
           Product: D
           Version: 2.040
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au



A simple variation of bug 4093.

struct Zug(int Z){
    const bahn = Bug4094!(0).hof.bahn;
}

struct Bug4094(int Q){
    Zug!(0) hof;
}

const a = Zug!(0).bahn;
---------
Assertion failure: 'type' on line 6192 in file 'expression.c'

abnormal program termination

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 15 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4094


Don <clugdbug yahoo.com.au> changed:

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



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: -------
Apr 20 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4094


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



17:38:01 PDT ---
When I try this patch, the bug remains.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 26 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4094


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



The root cause is just same as bug 9494.

https://github.com/D-Programming-Language/dmd/pull/1662

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 18 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4094


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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