Open xmh0511 opened 8 months ago
According to [temp.param]/17
[...] Similarly, a template parameter pack that is a type-parameter with a template-parameter-list containing one or more unexpanded packs is a pack expansion. [...]
This means that whenever the declaration of A<int, int>::fun
gets instantiated, T ...v
expands the unexpanded pack T
. That means by the time you can start doing overload resolution with A<int, int>::fun
, its template parameter list looks like template <int, int> class... Tmpl
.
I don't see any need for a wording change here. If a compiler has a bug, please report it to the developers.
Full name of submitter (unless configured in github; will be published with the issue): Jim X
Consider this example:
[temp.arg.template] p3 says:
Do we consider
T... v
as a template pack when checking this rule? If we do, how do we check whether the template parameters inB
orC
can matchT... v
?Or, should we consider
T... v
as the result of the instantiation of the pattern of the pack expansion to check whetherB
matchesTmpl
?Suggested Resolution
GCC and Clang seem both cannot correctly compile this code, GCC rejected this case with the wrong reason, Clang is wrong to accept this example because
template<int, int> class ...Tmpl
(after the instantiation of the enclosing template class) cannot matchtemplate<int> class B
, I think.