llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Younan Zhang (zyn0217)

<details>
<summary>Changes</summary>

The default RAV implementation refuses to traverse NNS's typeloc recursively, 
and template parameters inside DependentNameType are overlooked inadvertently.

No release note as what regression patches always do.

Endless bug
Fixes https://github.com/llvm/llvm-project/issues/184562
to our poor concept implementation :/



---
Full diff: https://github.com/llvm/llvm-project/pull/184771.diff


2 Files Affected:

- (modified) clang/lib/Sema/SemaConcept.cpp (+3-2) 
- (modified) clang/test/SemaTemplate/instantiate-requires-expr.cpp (+31) 


``````````diff
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 38791940247cb..b4816bcbd0ee8 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -381,9 +381,10 @@ class HashParameterMapping : public 
RecursiveASTVisitor<HashParameterMapping> {
     return true;
   }
 
-  bool TraverseTypeLoc(TypeLoc TL, bool TraverseQualifier = true) {
+  bool TraverseTypeLoc(TypeLoc TL, bool /*TraverseQualifier*/ = true) {
     // We don't care about TypeLocs. So traverse Types instead.
-    return TraverseType(TL.getType().getCanonicalType(), TraverseQualifier);
+    return TraverseType(TL.getType().getCanonicalType(),
+                        /*TraverseQualifier=*/true);
   }
 
   bool TraverseTagType(const TagType *T, bool TraverseQualifier) {
diff --git a/clang/test/SemaTemplate/instantiate-requires-expr.cpp 
b/clang/test/SemaTemplate/instantiate-requires-expr.cpp
index 32ad5374f46a7..b89cab615f997 100644
--- a/clang/test/SemaTemplate/instantiate-requires-expr.cpp
+++ b/clang/test/SemaTemplate/instantiate-requires-expr.cpp
@@ -278,3 +278,34 @@ namespace sugared_instantiation {
   static_assert(requires { { f() } -> C; });
   static_assert(requires { { f() } -> D; });
 } // namespace sugared_instantiation
+
+namespace GH184562 {
+
+template <typename T>
+struct tid {
+  using type = T;
+};
+template <typename T>
+using tid_t = tid<T>::type;
+
+template <class T, int N = ::tid_t<T>::value>
+concept req = N < 3 || requires { typename T::template as_two<3>; };
+
+struct two {
+  static constexpr int value = 2;
+};
+
+struct three {
+  static constexpr int value = 3;
+  template <int>
+  using as_two = two;
+};
+
+template <req T>
+struct test {
+  using type = test<typename T::template as_two<1>>;
+};
+
+test<three> x;
+
+}

``````````

</details>


https://github.com/llvm/llvm-project/pull/184771
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to