Skip to content

Commit ec97d65

Browse files
authored
1 parent 7e821de commit ec97d65

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

clang/lib/Sema/SemaConcept.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,15 @@ SubstituteConstraintExpression(Sema &S,
794794
if (Inst.isInvalid())
795795
return nullptr;
796796

797+
// Set up a dummy 'instantiation' scope in the case of reference to function
798+
// parameters that the surrounding function hasn't been instantiated yet. Note
799+
// this may happen while we're comparing two templates' constraint
800+
// equivalence.
801+
LocalInstantiationScope ScopeForParameters(S);
802+
if (auto *FD = llvm::dyn_cast<FunctionDecl>(DeclInfo.getDecl()))
803+
for (auto *PVD : FD->parameters())
804+
ScopeForParameters.InstantiatedLocal(PVD, PVD);
805+
797806
std::optional<Sema::CXXThisScopeRAII> ThisScope;
798807
if (auto *RD = dyn_cast<CXXRecordDecl>(DeclInfo.getDeclContext()))
799808
ThisScope.emplace(S, const_cast<CXXRecordDecl *>(RD), Qualifiers());

0 commit comments

Comments
 (0)