Fix for issue #440

This commit is contained in:
kai
2013-08-17 13:00:07 +02:00
parent 89f59b4eeb
commit b1160c3d16
2 changed files with 12 additions and 4 deletions

View File

@@ -450,9 +450,17 @@ void TypeInfoEnumDeclaration::llvmDefine()
// otherwise emit a void[] with the default initializer
else
{
LLType* memty = DtoType(sd->memtype);
LLConstant* C = LLConstantInt::get(memty, sd->defaultval->toInteger(), !isLLVMUnsigned(sd->memtype));
b.push_void_array(C, sd->memtype, sd);
Type *memtype = sd->memtype;
LLType *memty = DtoType(memtype);
LLConstant *C;
if (memtype->isintegral())
C = LLConstantInt::get(memty, sd->defaultval->toInteger(), !isLLVMUnsigned(memtype));
else if (memtype->isString())
C = DtoConstString(static_cast<const char *>(sd->defaultval->toString()->string));
else
llvm_unreachable("Unsupported type");
b.push_void_array(C, memtype, sd);
}
// finish