aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaConcept.cpp
diff options
context:
space:
mode:
authorYounan Zhang <zyn7109@gmail.com>2024-11-04 22:35:32 +0800
committerGitHub <noreply@github.com>2024-11-04 22:35:32 +0800
commit227afac307fac0d4c8ac2a3709df415e34629883 (patch)
tree5a746f8455393e277bf10fd0d316feb73484689e /clang/lib/Sema/SemaConcept.cpp
parent2f1a0df72a3cf5b0f927a8c519cf327c4d0d008e (diff)
downloadllvm-227afac307fac0d4c8ac2a3709df415e34629883.zip
llvm-227afac307fac0d4c8ac2a3709df415e34629883.tar.gz
llvm-227afac307fac0d4c8ac2a3709df415e34629883.tar.bz2
[Clang] Consider outer instantiation scopes for constraint normalization (#114749)
We need to compare constraint expressions when instantiating a friend declaration that is lexically defined within a class template. Since the evaluation is deferred, the expression might refer to untransformed function parameters such that the substitution needs the mapping of instantiation. These mappings are maintained by the function declaration instantiation, so we need to establish a "transparent" LocalInstantiationScope before substituting into the constraint. No release note as this fixes a regression in 19. Fixes https://github.com/llvm/llvm-project/issues/114685
Diffstat (limited to 'clang/lib/Sema/SemaConcept.cpp')
-rw-r--r--clang/lib/Sema/SemaConcept.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index e36ee06..bc98800 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -975,7 +975,7 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction(
std::optional<LocalInstantiationScope> ScopeForParameters;
if (const NamedDecl *ND = DeclInfo.getDecl();
ND && ND->isFunctionOrFunctionTemplate()) {
- ScopeForParameters.emplace(S);
+ ScopeForParameters.emplace(S, /*CombineWithOuterScope=*/true);
const FunctionDecl *FD = ND->getAsFunction();
for (auto *PVD : FD->parameters()) {
if (!PVD->isParameterPack()) {