================ @@ -547,6 +547,15 @@ static void DoEmitAvailabilityWarning(Sema &S, AvailabilityResult K, return; } case AR_Deprecated: + // Suppress -Wdeprecated-declarations in purely implicit special-member functions. + if (auto *MD = dyn_cast_if_present<CXXMethodDecl>(S.getCurFunctionDecl()); + MD && MD->isImplicit() && MD->isDefaulted() && + (isa<CXXConstructorDecl, CXXDestructorDecl>(MD) || + MD->isCopyAssignmentOperator() || + MD->isMoveAssignmentOperator())) { + return; + } + ---------------- shashi1687 wrote:
**“dyn_cast_if_present<FunctionDeck>” causes compile errors** There is no FunctionDeck class in Clang’s AST, so that cast will never compile. The correct cast here is to CXXMethodDecl (or at most to FunctionDecl). We’ve updated the code to use: ``` if (auto *MD = dyn_cast_if_present<CXXMethodDecl>(…); MD && MD->isImplicit() /*…etc…*/ ) return; ``` This change compiles cleanly and continues to limit suppression to only the implicitly-generated special-member methods. https://github.com/llvm/llvm-project/pull/147400 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits