You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A template parameter pack of a function template shall not be followed by another template parameter unless that template parameter can be deduced from the parameter-type-list ([dcl.fct]) of the function template or has a default argument ([temp.deduct]).
The intent of the restriction is that it is not permitted to write template parameter lists for which it is impossible to provide all arguments. However, [temp.param] paragraph 17 states that Tail... is not just a parameter pack but also a pack expansion. Considering that it expands to int, float in this example, following this restriction literally is nonsensical; it is clearly possible to provide (non-type) template-arguments to test<char, int, float>::make because it accepts exactly three.
Eisenwave
changed the title
[temp.param] Clarify how many template-arguments correspond to a template parameter pack which is also an expansion
[temp.param] Unintentional restrictons on parameters packs which are also pack expansions
Jan 20, 2025
Eisenwave
changed the title
[temp.param] Unintentional restrictons on parameters packs which are also pack expansions
[temp.param] Unintentional restrictions on parameters packs which are also pack expansions
Jan 20, 2025
jensmaurer
changed the title
[temp.param] Unintentional restrictions on parameters packs which are also pack expansions
CWG2994 [temp.param] Unintentional restrictions on parameters packs which are also pack expansions
Feb 23, 2025
Reference (section label): [temp.param] paragraph 14
Issue description
There is implementation divergence in the following example:
Clang permits this example, but MSVC abides by [temp.param] paragraph 14, sentence 3:
The intent of the restriction is that it is not permitted to write template parameter lists for which it is impossible to provide all arguments. However, [temp.param] paragraph 17 states that
Tail...
is not just a parameter pack but also a pack expansion. Considering that it expands toint, float
in this example, following this restriction literally is nonsensical; it is clearly possible to provide (non-type) template-arguments totest<char, int, float>::make
because it accepts exactly three.Suggested resolution
Update [temp.param] paragraph 14 as follows:
The text was updated successfully, but these errors were encountered: