[clang] [Clang] resolve record declaration of defaulted comparison method by using the first argument (PR #96228)

Oleksandr T. via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 21 11:46:44 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);
----------------
a-tarasyuk wrote:

@zyn0217 Thanks for the feedback and for pointing out that helper. I've updated the code to use it. Previously, I used a solution similar to `DefineDefaultedComparison` to maintain a consistent approach, which might make sense at the `DefineDefaultedComparison` stage but not in `ComputeDefaultedComparisonExceptionSpec`.







https://github.com/llvm/llvm-project/pull/96228


More information about the cfe-commits mailing list