Skip to content

Commit 780508b

Browse files
committed
Fix for issue #424
1 parent 89f59b4 commit 780508b

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

gen/typinf.cpp

+11-3
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,17 @@ void TypeInfoEnumDeclaration::llvmDefine()
450450
// otherwise emit a void[] with the default initializer
451451
else
452452
{
453-
LLType* memty = DtoType(sd->memtype);
454-
LLConstant* C = LLConstantInt::get(memty, sd->defaultval->toInteger(), !isLLVMUnsigned(sd->memtype));
455-
b.push_void_array(C, sd->memtype, sd);
453+
Type *memtype = sd->memtype;
454+
LLType *memty = DtoType(memtype);
455+
LLConstant *C;
456+
if (memtype->isintegral())
457+
C = LLConstantInt::get(memty, sd->defaultval->toInteger(), !isLLVMUnsigned(memtype));
458+
else if (memtype->isString())
459+
C = DtoConstString(static_cast<const char *>(sd->defaultval->toString()->string));
460+
else
461+
llvm_unreachable("Unsupported type");
462+
463+
b.push_void_array(C, memtype, sd);
456464
}
457465

458466
// finish

tests/d2/dmd-testsuite

Submodule dmd-testsuite updated 1 file

0 commit comments

Comments
 (0)