August 15, 2016
Just a small bug found while trying to generalize template parameter packs for C++11 support in Calypso (implementing it in DMD is more intrusive that I would like, but I can't see any simple alternative):


https://github.com/dlang/dmd/blob/7e60772afac6401b934981df5e2b33b33487514a/src/dtemplate.d#L8120

> if (i < nparams && (*tempdecl.parameters)[i].specialization())
>     buf.writeByte('H'); // https://issues.dlang.org/show_bug.cgi?id=6574

isn't correct when i and args get switched by:


https://github.com/dlang/dmd/blob/7e60772afac6401b934981df5e2b33b33487514a/src/dtemplate.d#L8205

> // Tuple va = isTuple(o);
> else if (va)
> {
>     assert(i + 1 == args.dim); // must be last one
>     args = &va.objects;
>     i = -cast(size_t)1;
> }

But this begged a question: why and how do some template instances end up with Tuple in their tiargs?

The presence of Tuple doesn't seem consistent with findBestMatch which expands Tuple tdtypes into multiple tiargs:


https://github.com/dlang/dmd/blob/7e60772afac6401b934981df5e2b33b33487514a/src/dtemplate.d#L7706

Having to deal with the two possible cases, one where Tuple get expanded, the other where they're aren't, makes adding support for multiple parameter packs much harder.

Any good reason for not wanting a Tuple-free tiargs?