[clang] [Clang] Fix -Wunused-private-field false negative with defaulted comparison operators (PR #116871)
Chris White via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 20 10:36:51 PST 2024
================
@@ -7535,7 +7535,7 @@ void Sema::CheckExplicitlyDefaultedFunction(Scope *S, FunctionDecl *FD) {
return;
}
- if (DefKind.isComparison())
+ if (DefKind.isComparison() && isa<CXXRecordDecl>(FD->getDeclContext()))
UnusedPrivateFields.clear();
----------------
whiteio wrote:
Thanks for the pointers! I believe I understand now. I've push a new commit with the changes 1f64a2bb972f5cf9e6455eb721acfd8281ad6981
https://github.com/llvm/llvm-project/pull/116871
More information about the cfe-commits
mailing list