www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5214] New: Compiler crash with array of empty {}

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

           Summary: Compiler crash with array of empty {}
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2010-11-13 14:43:21 PST ---
This D2 program crashes DMD 2.050:


auto foos = [{}];
void main() {}

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


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code, patch
                 CC|                            |clugdbug yahoo.com.au


--- Comment #1 from Don <clugdbug yahoo.com.au> 2010-11-13 18:22:30 PST ---
PATCH: declaration.c, line 751.
init->toExpression returns NULL if it fails. (BTW this is case where
non-nullable types would catch a bug <g>. Although it was trivial to track
down, it's lain hidden in the code for ages).
Give it the same error message as happens in D1.


            if (ai->isAssociativeArray())
                e = ai->toAssocArrayLiteral();
            else
                e = init->toExpression();
+            if (!e)
+            {
+                error("cannot infer type from initializer");
+                e = new ErrorExp();
+            }
            init = new ExpInitializer(e->loc, e);
            type = init->inferType(sc);

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


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2010-12-05
00:27:23 PST ---
http://www.dsource.org/projects/dmd/changeset/780

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