[temp.arg.explicit] doesn't allow converting arguments if they deduced template parameters in non-deduced context
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
Observation
This wording does not allow conversion in the argument if the parameter contains template parameters in non-deduced context, but they are otherwise deduced.
Expectation
The wording to allow conversion if all the template parameters in the function parameter are explicitly specified or appear in non-deduced context.
Examples
Example 1
#include <type_traits>
template <typename T>
struct A {
A();
A(T);
};
template <typename T>
void bar(A<std::type_identity_t<T>>, A<T>);
void foo() {
bar(42, A<int>{}); // conversion from int to A<int> in the first argument
In the example the first parameter contains the template parameter T, and T participates in template argument deduction. So the wording doesn't enable implicit conversion in that argument.
Compilers seem to agree that conversion is allowed there: https://godbolt.org/z/aPdK64zeG
Example 2
There is a similar example in the standard too:
Here the conversion happens in the first argument.
Suggestion
I suggest to replace the wording with the following:
Implicit conversions ([conv]) will be performed on a function argument to convert it to the type of the corresponding function parameter if all the template-parameters it contains are explicitly specified or appear in non-deduced context.
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 in source/templates.tex at the linked [temp.arg.explicit] wording and read the surrounding paragraphs. Compare it with the linked standard example and the two supplied C++ examples, then update the wording so the described conversions are permitted and verify the draft reflects the intended rule.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100