diff gen/classes.cpp @ 1270:dd135ff697fa

Fixed class default initializers and type generation. Bug #260 is fixed.
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Mon, 27 Apr 2009 03:40:40 +0200
parents ec1d9dc1d32a
children 0c03ba6f7c24
line wrap: on
line diff
--- a/gen/classes.cpp	Mon Apr 27 01:43:29 2009 +0200
+++ b/gen/classes.cpp	Mon Apr 27 03:40:40 2009 +0200
@@ -205,7 +205,11 @@
 
     // copy the rest from the static initializer
     LLValue* dstarr = DtoGEPi(dst,0,2,"tmp");
-    LLValue* srcarr = DtoGEPi(tc->sym->ir.irStruct->getInitSymbol(),0,2,"tmp");
+
+    // init symbols might not have valid types
+    LLValue* initsym = tc->sym->ir.irStruct->getInitSymbol();
+    initsym = DtoBitCast(initsym, DtoType(tc));
+    LLValue* srcarr = DtoGEPi(initsym,0,2,"tmp");
 
     DtoMemCpy(dstarr, srcarr, DtoConstSize_t(n));
 }