www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4781] New: Segfault(mtype.c) with forward referenced typeof and .init

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

           Summary: Segfault(mtype.c) with forward referenced typeof and
                    .init
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au


--- Comment #0 from Don <clugdbug yahoo.com.au> 2010-09-01 02:20:22 PDT ---
typeof(a4781.init) b4781;
typeof(7) a4781;

--> Segfault on D1 & D2.

By contrast, this related case gives a forward reference error followed by a
useless "voids have no value" message.

typeof(d4781) c4781;
typeof(7) d4781;

And, this third case also segfaults, but here we have a genuine circular
reference which should not compile.

auto e4781 = f4781.init;
typeof(e4781) f4781;

and another circular reference which currently gives a forward reference error.

typeof(g4781) h4781;
typeof(h4781) g4781;

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


Don <clugdbug yahoo.com.au> changed:

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


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-09-01 02:29:51 PDT ---
A quick patch to turn it into a rejects-valid:
mtype.c, Type::dotExp, line 1795


+            Expression *eold = e;
            e = defaultInitLiteral(e->loc);
+            if (!e)
+            {
+                eold->error("forward referenced .init (Bugzilla 4781)");
+                return new ErrorExp();
+            }
            goto Lreturn;
        }
    }
    if (ident == Id::typeinfo)
    {

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


Don <clugdbug yahoo.com.au> changed:

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


--- Comment #2 from Don <clugdbug yahoo.com.au> 2010-11-15 00:03:25 PST ---
Fixed svn 755.

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