[temp.deduct.conv] Implementations think there is a defect in this subclause
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
#include <iostream>
struct C{
template<typename Type>
operator Type(){
Type a{};
return a;
}
};
int main(){
int const& rf = C{};
}
Consider the above example, the rules about deducing conversion function template arguments in defined as
[temp.deduct.conv] p1
Template argument deduction is done by comparing the return type of the conversion function template (call it P) with the type specified by the conversion-type-id of the conversion-function-id being looked up (call it A) as described in [temp.deduct.type]. If the conversion-function-id is constructed during overload resolution ([over.match.funcs]), the following transformations apply.
Implementations give the deduced A with the type int. However, according to [temp.deduct.conv] p1, [temp.deduct.conv] p2, [temp.deduct.conv] p3, and [temp.deduct.conv] p4, the deduced A should be int const. Since [temp.deduct.conv] p4 remove the top-level cv-qualifier prior to remove the reference. For this divergence, Clang's sources give the interpretation, which says
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.conv] paragraphs 1–4 and compare their deduction order with the Godbolt example linked in the issue. Read the referenced Clang logic in clang/lib/Sema/SemaTemplateDeduction.cpp around lines 4430–4437. Done means reaching an agreed resolution for the discrepancy and, if necessary, clarifying the draft wording.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100