release/19.x: [Clang] Consider outer instantiation scopes for constraint normalization
authorYounan Zhang <zyn7109@gmail.com>
Tue, 5 Nov 2024 08:25:35 +0000 (16:25 +0800)
committerTobias Hieta <tobias@hieta.se>
Fri, 15 Nov 2024 08:20:15 +0000 (09:20 +0100)
Backport 227afac3

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

index 244f6ef2f53faa885a46d701aeb0aeb410bed15c..c45443d76e6bad7611126e4c74da531f19791577 100644 (file)
@@ -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()) {
index 333187b0d74ad6279b7ebffc6bd4e7d10c5b9fb3..c5dd855f0c000be6fd467416501c30c3c220465f 100644 (file)
@@ -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