cplusplus / CWG

Core Working Group
23 stars 7 forks source link

[temp.deduct.type] p4 The "certain context" is underspecified for which cases does not participate in deduction #445

Open xmh0511 opened 9 months ago

xmh0511 commented 9 months ago

Full name of submitter (unless configured in github; will be published with the issue): Jim X

[temp.deduct.type] p4 says:

In certain contexts, however, the value does not participate in type deduction, but instead uses the values of template arguments that were either deduced elsewhere or explicitly specified.

We do not clearly specify what the context is. Moreover, "the value"(emphasized) is not consistent with other utterances used in other subclauses, for example, [temp.deduct.call] p1

Template argument deduction is done by comparing each function template parameter type (call it P) that contains template-parameters that participate in template argument deduction with the type of the corresponding argument of the call (call it A) as described below.

We say template-parameters participate in deduction instead of value.

Suggested Resolution

We should associate the "context" with the non-deduced context, and say whether a template parameter participates in the template argument deduction or not.

template<class ...T>
void fun(std::tuple<T...>, std::type_identity<T>...){}

The template parameter pack in the second function parameter does not participate in deduction, I think.