diff --git a/gen/functions.cpp b/gen/functions.cpp index a006a6ff..03ba310a 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -145,7 +145,7 @@ const llvm::FunctionType* DtoFunctionType(Type* type, Type* thistype, Type* nest argtype = ltd; } // byval - else if (abi->passByVal(argtype)) + else if (abi->passByVal(byref ? argtype->pointerTo() : argtype)) { if (!byref) a |= llvm::Attribute::ByVal; byref = true;