diff --git a/gen/classes.cpp b/gen/classes.cpp index 512aefb6..cd029444 100644 --- a/gen/classes.cpp +++ b/gen/classes.cpp @@ -632,13 +632,19 @@ L2: inits.push_back(c); // offset typeinfo - // TODO c = build_offti_array(cd, cinfo->llvmInitZ->getOperand(10)); inits.push_back(c); // default constructor - // TODO - c = cinfo->llvmInitZ->getOperand(11); + if (cd->defaultCtor) { + DtoForceDeclareDsymbol(cd->defaultCtor); + c = isaConstant(cd->defaultCtor->llvmValue); + //const llvm::Type* toTy = cinfo->llvmInitZ->getOperand(11)->getType(); + c = llvm::ConstantExpr::getBitCast(c, llvm::PointerType::get(llvm::Type::Int8Ty)); // toTy); + } + else { + c = cinfo->llvmInitZ->getOperand(11); + } inits.push_back(c); /*size_t n = inits.size(); diff --git a/llvmdc.kdevelop.filelist b/llvmdc.kdevelop.filelist index d26706a7..f6743913 100644 --- a/llvmdc.kdevelop.filelist +++ b/llvmdc.kdevelop.filelist @@ -337,6 +337,7 @@ test/classes8.d test/classinfo1.d test/classinfo2.d test/classinfo3.d +test/classinfo4.d test/comma.d test/complex1.d test/complex2.d diff --git a/test/classinfo4.d b/test/classinfo4.d new file mode 100644 index 00000000..f28c40a8 --- /dev/null +++ b/test/classinfo4.d @@ -0,0 +1,18 @@ +module classinfo4; + +class C +{ +} + +class D +{ + this() + { + } +} + +void main() +{ + assert(C.classinfo.defaultConstructor is null); + assert(D.classinfo.defaultConstructor !is null); +}