In some cases, the deduction is done using a single set of types P and A, in other cases, there will be a set of corresponding types P and A. Type deduction is done independently for each P/A pair, and the deduced template argument values are then combined. If type deduction cannot be done for any P/A pair, or if for any pair the deduction leads to more than one possible set of deduced values, or if different pairs yield different deduced values, or if any template argument remains neither deduced nor explicitly specified, template argument deduction fails.
Consider the above sentence, whose the template argument belong to? Does it refer to template arguments of the template which the type P origin from , or that of a template that P naming? Through reading this sentence, I can't determine which it refers to.
template<typename T, typename U = T>
struct Test{};
template<typename T, typename U = T>
void func(Test<T>){}
int main(){
func(Test<char, char>{});
}
Question 1
In other words, the template argument in above sentence refer to that for function template func or that for class template Test? Both template need template argument to form a specialization.
Question 2
If template argument refer to class template Test's, that is,
For P/A pair , namely Test<T> / Test<char, char>, The process compares T with char, then the deduced value for T is char, since there's no any other Pi in template-argument-list of P, So there is nothing else to be deduced. After deduction performed for each Pi that participates in template argument deduction, there's a second template parameter of Test remain no template argument and the value for it is neither deduced or explicitly specified, The template argument is obtained from default argument, So Does the emphasized paragraph not cover this case?(Obtain from default arguments means the way to get template argument value is neither through deduced nor explicitly specified). So the deduction would fails? I think it does not fail. If I misunderstand about what is template argument deduction success, please point it out.