[Issue 4460] Regression(2.036) ICE(e2ir.c) when compiling foreach over associative array literal

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 23 12:43:20 PDT 2011


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


Iain Buclaw <ibuclaw at ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |ibuclaw at ubuntu.com


--- Comment #6 from Iain Buclaw <ibuclaw at ubuntu.com> 2011-04-23 12:39:40 PDT ---
Patch:

diff --git a/src/mtype.c b/src/mtype.c
index f8ad06e..1d1fcd6 100644
--- a/src/mtype.c
+++ b/src/mtype.c
@@ -4173,6 +4173,17 @@ Expression *TypeAArray::dotExp(Scope *sc, Expression *e,
Identifier *ident)
     else
 #endif
     {
+        /* Create a new temporary variable for literal arrays.
+         */
+        if (e->op == TOKassocarrayliteral)
+        {
+            Identifier *idtmp = Lexer::uniqueId("__aatmp");
+            VarDeclaration *aatmp = new VarDeclaration(loc, e->type, idtmp,
new ExpInitializer(0, e));
+            aatmp->storage_class |= STCctfe;
+            Expression *ae = new DeclarationExp(loc, aatmp);
+            e = new CommaExp(loc, ae, new VarExp(loc, aatmp));
+            e = e->semantic(sc);
+        }
         e->type = getImpl()->type;
         e = e->type->dotExp(sc, e, ident);
         //e = Type::dotExp(sc, e, ident);

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