diff --git a/gen/functions.cpp b/gen/functions.cpp index 4b1bcb3b..3d5f84c3 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -129,7 +129,16 @@ llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nesttype, // member functions if (thistype) { - fty.arg_this = new IrFuncTyArg(thistype, thistype->toBasetype()->ty == Tstruct); +#if LDC_LLVM_VER >= 303 + llvm::AttrBuilder attrBuilder; + if (f->funcdecl && f->funcdecl->isCtorDeclaration()) + attrBuilder.addAttribute(llvm::Attribute::Returned); +#endif + fty.arg_this = new IrFuncTyArg(thistype, thistype->toBasetype()->ty == Tstruct +#if LDC_LLVM_VER >= 303 + , attrBuilder +#endif + ); lidx++; }