[clang] [Clang] resolve record declaration of defaulted comparison method by using the first argument (PR #96228)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 20 18:49:24 PDT 2024
================
@@ -9192,7 +9194,7 @@ ComputeDefaultedComparisonExceptionSpec(Sema &S, SourceLocation Loc,
EnterExpressionEvaluationContext Context(
S, Sema::ExpressionEvaluationContext::Unevaluated);
- CXXRecordDecl *RD = cast<CXXRecordDecl>(FD->getLexicalParent());
+ auto RD = getRecordDeclFromFirstParameter(FD);
----------------
zyn0217 wrote:
Hmmm... Does `cast<CXXRecordDecl>(FD->getDeclContext())` work? That way, we can avoid the `getRecordDeclFromFirstParameter` whole thing.
I suspect the current approach isn't right here because 1. we have to ensure FD is a CXXMethodDecl; 2. the parameter list could be empty and thus we probably run into an out-of-bound error.
https://github.com/llvm/llvm-project/pull/96228
More information about the cfe-commits
mailing list