Open xmh0511 opened 1 week ago
A relevant example that causes implementations to have divergence is https://godbolt.org/z/6xq6n8z8Y, Clang accepts it while GCC reports a similar error
mismatched argument pack lengths while expanding 'e<infix, j>'
This example can be simplified to
#include <iostream>
template<class ,std::size_t N>
concept True = true;
template<std::size_t ... N>
struct C{
template<True<N>... T, True<N>... U>
static void fun(T... t,U...){}
};
int main(){
C<0,1,2>::fun(1,2,3,4,5,6);
}
Clang is Ok while GCC thinks the remaining arguments should be used to deduce the template arguments for True<N>... T
.
Deduction can never change template arguments from an outer context (i.e. the arguments for "N" from the outer "C" template).
Deduction can never change template arguments from an outer context (i.e. the arguments for "N" from the outer "C" template).
Never change can be simplified to "not perform", It seems to lack wording that specifies the deduction does not perform to the template parameter pack introduced by a template-parameter that is a pack expansion, nor to a function parameter whose type is such a pack.
Full name of submitter (unless configured in github; will be published with the issue): Jim X
Consider this example:
[temp.arg.explicit] p9 says:
[temp.deduct.call] p1 says:
In this example,
True<N>... T
declares a template parameter pack andT... t
is a function parameter pack that expands the template parameter pack declared in the former.[temp.variadic] p1 and p2
According to these rules, the example should be otherwise ok. However, major implementations reject this example and give different reasons.
GCC says:
Clang says:
Suggested Resolution
We either need to say