[llvm-branch-commits] [clang] 33c4723 - release/19.x: [Clang] Consider outer instantiation scopes for constraint normalization

Tobias Hieta via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 15 00:20:15 PST 2024


Author: Younan Zhang
Date: 2024-11-15T09:20:15+01:00
New Revision: 33c4723541d7de5399e07c1fb48c5e779c3fb564

URL: https://github.com/llvm/llvm-project/commit/33c4723541d7de5399e07c1fb48c5e779c3fb564
DIFF: https://github.com/llvm/llvm-project/commit/33c4723541d7de5399e07c1fb48c5e779c3fb564.diff

LOG: release/19.x: [Clang] Consider outer instantiation scopes for constraint normalization

Backport 227afac3

Added: 
    

Modified: 
    clang/lib/Sema/SemaConcept.cpp
    clang/test/SemaTemplate/concepts-out-of-line-def.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 244f6ef2f53faa..c45443d76e6bad 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -967,7 +967,7 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction(
   // parameters that the surrounding function hasn't been instantiated yet. Note
   // this may happen while we're comparing two templates' constraint
   // equivalence.
-  LocalInstantiationScope ScopeForParameters(S);
+  LocalInstantiationScope ScopeForParameters(S, /*CombineWithOuterScope=*/true);
   if (auto *FD = DeclInfo.getDecl()->getAsFunction())
     for (auto *PVD : FD->parameters()) {
       if (!PVD->isParameterPack()) {

diff  --git a/clang/test/SemaTemplate/concepts-out-of-line-def.cpp b/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
index 333187b0d74ad6..c5dd855f0c000b 100644
--- a/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
+++ b/clang/test/SemaTemplate/concepts-out-of-line-def.cpp
@@ -622,3 +622,19 @@ void A<T>::method(Ts&... ts)
   } {}
 
 }
+
+namespace GH114685 {
+
+template <typename T> struct ptr {
+  template <typename U>
+  friend ptr<U> make_item(auto &&args)
+    requires(sizeof(args) > 1);
+};
+
+template <typename U>
+ptr<U> make_item(auto &&args)
+  requires(sizeof(args) > 1) {}
+
+ptr<char> p;
+
+} // namespace GH114685


        


More information about the llvm-branch-commits mailing list