[dmd-internals] Small bug in TemplateInstance.genIdent and question about Tuple in tiargs
Elie Morisse via dmd-internals
dmd-internals at puremagic.com
Mon Aug 15 13:04:09 PDT 2016
Just a small bug found while trying to generalize template
parameter packs for C++11 support in Calypso (this is more
intrusive that I would like, but I can't see any simple
alternative to implementing it in DMD):
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 begs a question: why and how does 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 are
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?
More information about the dmd-internals
mailing list