n4567 [temp.class.spec.match]p2
A partial specialization matches a given actual template argument list if the template arguments of the partial specialization can be deduced from the actual template argument list (14.8.2).
template<class T, class U>
struct S{};
template<class U>
struct S<int, U>{};
S<char, int> s;
I know partial specialization S<int, U>
do not match the actual template argument list char, int
, and the second argument U
can be deduced frome int
accroding to 14.8.2.5.
But I don't know which rules in 14.8.2 apply for the first argument int
.
14.8.2.5 [temp.deduct.type]p1
Template arguments can be deduced in several different contexts, but in each case a type that is specified in terms of template parameters (call it
P
) is compared with an actual type (call itA
), and an attempt is made to find template argument values (a type for a type parameter, a value for a non-type parameter, or a template for a template parameter) that will makeP
, after substitution of the deduced values (call it the deducedA
), compatible withA
.
In my understanding the int
in S<int, U>
is not specified in terms of template parameters, so 14.8.2.5 does not apply.
I want to know which rules handle this case or you can correct me about 14.8.2.5
In other words:
Intuitively, the partial specialization S<int, U>
does not match char,int
because char
does not match int
.
I want to know which rules determine char
does not match int
.