[clang] [Clang][Concepts] Correct the CurContext for friend declarations (PR #106890)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 1 22:42:22 PDT 2024
================
@@ -1012,7 +1012,14 @@ static const Expr *SubstituteConstraintExpressionWithoutSatisfaction(
// possible that e.g. constraints involving C<Class<T>> and C<Class> are
// perceived identical.
std::optional<Sema::ContextRAII> ContextScope;
- if (auto *RD = dyn_cast<CXXRecordDecl>(DeclInfo.getDeclContext())) {
+ const DeclContext *DC = [&] {
+ if (!DeclInfo.getDecl())
+ return DeclInfo.getDeclContext();
+ return DeclInfo.getDecl()->getFriendObjectKind()
+ ? DeclInfo.getLexicalDeclContext()
+ : DeclInfo.getDeclContext();
----------------
zyn0217 wrote:
Agreed, probably something like `Decl::getFriendDeclContext()`
https://github.com/llvm/llvm-project/pull/106890
More information about the cfe-commits
mailing list