diff gen/toir.cpp @ 197:bfcb657756f6 trunk

[svn r213] Fixed: foreach on an object seems to have been broken, the issue was that DMD generates an implicit delegate with conflicting types for 'this'. Fixed: string switch runtime support had wrong param types. Fixed: string switch on a temporary slice was broken.
author lindquist
date Mon, 12 May 2008 20:02:52 +0200
parents aca17e55b7a5
children 8f9191180c7a
line wrap: on
line diff
--- a/gen/toir.cpp	Mon May 12 19:10:41 2008 +0200
+++ b/gen/toir.cpp	Mon May 12 20:02:52 2008 +0200
@@ -1510,6 +1510,9 @@
         v = p->func()->decl->ir.irFunc->thisVar;
         if (llvm::isa<llvm::AllocaInst>(v))
             v = new llvm::LoadInst(v, "tmp", p->scopebb());
+        const llvm::Type* t = DtoType(type);
+        if (v->getType() != t)
+            v = DtoBitCast(v, t, "tmp");
         return new DThisValue(vd, v);
     }
 
@@ -1680,7 +1683,7 @@
 
     Type* t = DtoDType(e1->type);
     Type* e2t = DtoDType(e2->type);
-    assert(t == e2t);
+    assert(DtoType(t) == DtoType(e2t));
 
     llvm::Value* eval = 0;