Open hokein opened 1 month ago
@llvm/issue-subscribers-clang-frontend
Author: Haojian Wu (hokein)
Can you provide and example that would demonstrate the difference? I am looking at the example from the DR: https://godbolt.org/z/WEaqzd9he
and it is not obvious what behavior I should see and how I would determine it is correct.
If we look at it from a different angle (the AST point of view), it becomes more obvious https://godbolt.org/z/zed6846re:
template<class T> concept True = true;
template<class T> concept True2 = true;
template<class T>
requires True2<T>
struct X {
template<class U> requires True<U> X(T, U(&)[3]);
};
double arr3[3];
X z(3, arr3);
The implicit deduction guide is:
|-FunctionTemplateDecl <line:8:3, col:50> col:38 implicit <deduction guide for X>
| |-TemplateTypeParmDecl <line:5:10, col:16> col:16 referenced class depth 0 index 0 T
| |-TemplateTypeParmDecl <line:8:12, col:18> col:18 class depth 0 index 1 U
| |-ConceptSpecializationExpr <col:30, col:36> 'bool' Concept 0xcfa0880 'True'
| | |-ImplicitConceptSpecializationDecl <line:2:27> col:27
| | | `-TemplateArgument type 'type-parameter-0-1'
| | | `-TemplateTypeParmType 'type-parameter-0-1' dependent depth 0 index 1
| | `-TemplateArgument <line:8:35> type 'type-parameter-0-1'
| | `-TemplateTypeParmType 'type-parameter-0-1' dependent depth 0 index 1
| |-CXXDeductionGuideDecl <col:38, col:50> col:38 implicit <deduction guide for X> 'auto (T, type-parameter-0-1 (&)[3]) -> X<T>'
| | |-ParmVarDecl <col:40> col:41 'T'
| | `-ParmVarDecl <col:43, col:49> col:46 'type-parameter-0-1 (&)[3]'
The associated constraints is True<U>
, which is wrong. It should be True<U> && True2<T>
.
https://cplusplus.github.io/CWG/issues/2628.html