diff gen/toobj.c @ 58:2c3cd3596187 trunk

[svn r62] Added support for TypeInfo _Array, _Function, _Pointer, _Delegate, _Enum Added initial support for CatExp aka 'a ~ b' Fixed global constant static arrays initialized with string literals Fixed casting any dynamic array to void* Fixed new expression with temporary storage Fixed alias declarations in function scope Fixed relational comparisons of pointers
author lindquist
date Thu, 25 Oct 2007 09:02:55 +0200
parents a9d29e9f1fed
children 2c39b5292cf3
line wrap: on
line diff
--- a/gen/toobj.c	Thu Oct 25 02:39:53 2007 +0200
+++ b/gen/toobj.c	Thu Oct 25 09:02:55 2007 +0200
@@ -547,10 +547,14 @@
                 else if (llvm::isa<llvm::ArrayType>(_type))
                 {
                     const llvm::ArrayType* at = llvm::cast<llvm::ArrayType>(_type);
-                    assert(_type->getContainedType(0) == _init->getType());
-                    std::vector<llvm::Constant*> initvals;
-                    initvals.resize(at->getNumElements(), _init);
-                    _init = llvm::ConstantArray::get(at, initvals);
+                    if (at->getElementType() == _init->getType()) {
+                        std::vector<llvm::Constant*> initvals;
+                        initvals.resize(at->getNumElements(), _init);
+                        _init = llvm::ConstantArray::get(at, initvals);
+                    }
+                    else {
+                        assert(0);
+                    }
                 }
                 else {
                     Logger::cout() << "Unexpected initializer type: " << *_type << '\n';