Clang rejects the following valid code:
template <class T> struct Foo {}; template <class... Ts> using FooAlias = Foo<void(Ts...)>; template <class... Ts> int bar(FooAlias<Ts...>); int main() { bar(FooAlias<>()); }
The problem is that in the substitution of FooAlias<Ts...> during the parsing of bar, the pack expansion in Foo<void(Ts...)> is transformed into a parameter with the unexpanded flag set, as opposed to another pack expansion. This leads to deduction failing in main, which is incorrect. The fix is to expand the parameter pack when needed.
Fixes PR25250 & PR26017.
Incidentally, there was an incorrect comment in a very similar function that said that a path wasn't reachable. This isn't the case, although no existing test case exercised it, so I added one that did. Please let me know if it would be cleaner to commit that separately!
Thanks!