# HG changeset patch # User Frits van Bommel # Date 1238364043 -7200 # Node ID a668f40513682f699bfe6c7a6ee18ea4ba0cffb6 # Parent a8b9fc41c34b1ed44eddd55cc55556681b93a1c5 Fix a bug I noticed. Varargs were broken if preceded by tuple parameters. diff -r a8b9fc41c34b -r a668f4051368 gen/tocall.cpp --- a/gen/tocall.cpp Sun Mar 29 23:57:51 2009 +0200 +++ b/gen/tocall.cpp Mon Mar 30 00:00:43 2009 +0200 @@ -122,11 +122,12 @@ 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 @@ for (int i=begin; idata[i]; + assert(argexp->type->ty != Ttuple); vtypes.push_back(DtoType(argexp->type)); size_t sz = getTypePaddedSize(vtypes.back()); if (sz < PTRSIZE) diff -r a8b9fc41c34b -r a668f4051368 tests/mini/tuple_and_vararg.d --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/mini/tuple_and_vararg.d Mon Mar 30 00:00:43 2009 +0200 @@ -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); +}