There is a special situation with templates in local classes,
as can be seen in this example with generic lambdas in function scope:
template<class T1> void foo() { (void)[]<class T2>() { struct S { void bar() { (void)[]<class T3>(T2) {}; } }; }; }; template void foo<int>();
As a consequence of the resolution of DR1484, bar is instantiated during the
substitution of foo, and in this context we would substitute the lambda within
it with it's own parameters "injected" (turned into arguments).
This can't be properly dealt with for at least a couple of reasons:
- The 'TemplateTypeParm' type itself can only deal with canonical replacement types, which the injected arguments are not.
- If T3 were constrained in the example above, our (non-conforming) eager substitution of type constraints would just leave that parameter dangling.
Instead of substituting with injected parameters, this patch just leaves those
inner levels unreplaced.
Since injected arguments appear to be unused within the users of
getTemplateInstantiationArgs, this patch just removes that support there and
leaves a couple of asserts in place.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>