diff --git a/gen/tocall.cpp b/gen/tocall.cpp index f13c044f..a48ad2b1 100644 --- a/gen/tocall.cpp +++ b/gen/tocall.cpp @@ -122,11 +122,12 @@ const LLFunctionType* DtoExtractFunctionType(const LLType* type) void DtoBuildDVarArgList(std::vector& args, std::vector& attrs, TypeFunction* tf, Expressions* arguments, size_t argidx) { Logger::println("doing d-style variadic arguments"); + LOG_SCOPE std::vector vtypes; // number of non variadic args - int begin = tf->parameters->dim; + int begin = Argument::dim(tf->parameters); Logger::println("num non vararg params = %d", begin); // get n args in arguments list @@ -136,6 +137,7 @@ void DtoBuildDVarArgList(std::vector& args, std::vectordata[i]; + assert(argexp->type->ty != Ttuple); vtypes.push_back(DtoType(argexp->type)); size_t sz = getTypePaddedSize(vtypes.back()); if (sz < PTRSIZE) diff --git a/tests/mini/tuple_and_vararg.d b/tests/mini/tuple_and_vararg.d new file mode 100644 index 00000000..a6d3d901 --- /dev/null +++ b/tests/mini/tuple_and_vararg.d @@ -0,0 +1,13 @@ +// Based on dstress.run.t.tuple_15_A; + +module tuple_and_vararg; + +template TypeTuple(TList...){ + alias TList TypeTuple; +} + +void main(){ + auto y = function(TypeTuple!(uint,uint) ab, ...){}; + y(1, 2); + y(1, 2, "foo", 3.0); +}