https://github.com/zyn0217 created 
https://github.com/llvm/llvm-project/pull/184771

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 :/



>From 176953dc466bb82e85d6d4973de086a5390d2f33 Mon Sep 17 00:00:00 2001
From: Younan Zhang <[email protected]>
Date: Thu, 5 Mar 2026 18:52:34 +0800
Subject: [PATCH] [Clang] Fix a concept cache bug on DependentNameType

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.
---
 clang/lib/Sema/SemaConcept.cpp                |  5 +--
 .../instantiate-requires-expr.cpp             | 31 +++++++++++++++++++
 2 files changed, 34 insertions(+), 2 deletions(-)

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;
+
+}

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

Reply via email to