Is it an unclear wording about deducing template arguments for function parameter pack
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
template<typename...T>
void func(T...args){
}
int main(){
func(1,2.0,'c');
}
Consider the above code, there's a rule that applied to it to deduce these template arguments for this function template (call). It is:
temp.deduct.call#1
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. Each deduction deduces template arguments for subsequent positions in the template parameter packs expanded by the function parameter pack.
That means for the parameter-declaration T...args, it declares a function template park, hence the function parameter type that is used to against the type of function argument is T because ...args is the declarator-id of this declaration. So, for this function call func(1,2.0,'c'), template parameter pack T would be the set consists of {int,double,char}.
However, consider the following variant:
template<typename...T>
void func(T...){
}
int main(){
func(1,2.0,'c');
}
There's no declarator-id here, just an abstract-declarator that denote the ..., How would the quote be applied to this case? What's the corresponding function parameter type here? How to form this parameter type? Is it a defect for this case when draft the standard?
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#1] in the C++ draft and compare its wording against both func(T...args) and func(T...). Determine what function parameter type the rule specifies for the abstract-declarator case, and whether the wording needs correction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100