Thread overview
[Issue 3911] New: Associative array in CTFE crashes compiler
Mar 30, 2010
Don
Mar 30, 2010
Don
Apr 01, 2010
Walter Bright
March 09, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3911

           Summary: Associative array in CTFE crashes compiler
           Product: D
           Version: 2.041
          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-03-09 02:26:43 PST ---
This crashes the compiler:

auto bunch(T)(T[] items...) {
    return ["+" : 0];
}
enum int* r = "+" in bunch(1);
void main() {}



The following variant of the same program doesn't crash the compiler, but gives
a forward reference error, that seems wrong:
Error: forward reference to bunch


auto bunch() {
    return ["+" : 0];
}
enum int* r = "+" in bunch();
void main() {}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 30, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3911



--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-03-29 21:04:14 PDT ---
This fixes the ICE:
expression.c line 7181.
----

    if (!type)
    {
    error("forward reference to inferred return type of function call %s",
toChars());
    type = Type::terror;
+    return new ErrorExp();
    }

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
March 30, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3911



--- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-03-29 21:05:56 PDT ---
*** Issue 4012 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 01, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3911


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2010-04-01 14:53:37 PDT ---
changeset 430

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 09, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3911


bearophile_hugs@eml.cc changed:

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


--- Comment #4 from bearophile_hugs@eml.cc 2010-04-09 10:29:36 PDT ---
This bug was about two different problems, one of them is now fixed.
So I close this bug and move a simplified version of the code that generates
the error in bug 4075.

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