[temp.deduct.call] p1 The comment for a function parameter pack is conflict
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
For a function parameter pack that occurs at the end of the parameter-declaration-list, deduction is performed for each remaining argument of the call, taking the type P of the declarator-id of the function parameter pack as the corresponding function template parameter type.
The formal example after this rule:
template<class T1, class ... Types> void g1(Types ..., T1);
g1(x, y, z); // error: Types is not deduced
However, we have implied that a template parameter pack can accept zero arguments and be deduced an empty sequence of template arguments in [temp.arg.explicit] p4
[Note 1: A trailing template parameter pack ([temp.variadic]) not otherwise deduced will be deduced as an empty sequence of template arguments. — end note]
That is, it also does not matter if Types is not deduced. I think the real reason why the above example is an error is that T1 is not deduced. In addition, the requirement of performing the deduction for a function parameter pack is that the pack should occur at the end of the parameter-declaration-list. Does the deduction really need that requirement?
Consider an example in the GCC bug file list
template<int N> struct UniqueType{};
template<class ...T, class U, class... Y>
void fun(T..., U, Y...){}
fun(UniqueType<0>{},UniqueType<1>{},UniqueType<2>{});
U is deduced with UniqueType<0>. T is deduced with an empty sequence. The behavior is more and less related to the above rule: T is not deduced and otherwise deduced to an empty, U and Y participate in the deduction. If this result is the intent of the standard, the comment in the above should also be changed to
// error: Types is deduced to empty, wrong number of arguments
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with [temp.deduct.call] and the cited note in [temp.arg.explicit], then compare the two standard examples and the linked GCC example. Determine the intended deduction behavior and whether the end-of-parameter-declaration-list requirement is correct. Done means the wording and example comment consistently state the resolved rule.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100