[llvm-branch-commits] [clang] release/19.x: [Clang] Consider outer instantiation scopes for constraint normalization (PR #114951)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Nov 5 00:29:59 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Younan Zhang (zyn0217)
<details>
<summary>Changes</summary>
Backport 227afac3
---
Full diff: https://github.com/llvm/llvm-project/pull/114951.diff
2 Files Affected:
- (modified) clang/lib/Sema/SemaConcept.cpp (+1-1)
- (modified) clang/test/SemaTemplate/concepts-out-of-line-def.cpp (+16)
``````````diff
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
``````````
</details>
https://github.com/llvm/llvm-project/pull/114951
More information about the llvm-branch-commits
mailing list