[clang][c++20] Fix false warning for unused private fields when a class has...
[clang][c++20] Fix false warning for unused private fields when a class has only defaulted comparison operators. Fixes bug 50263 When "unused-private-field" flag is on if you have a struct with private members and only defaulted comparison operators clang will warn about unused private fields. If you where to write the comparison operators by hand no warning is produced. This is a bug since defaulting a comparison operator uses all private members . The fix is simple, in CheckExplicitlyDefaultedFunction just clear the list of unused private fields if the defaulted function is a comparison function. Differential revision: https://reviews.llvm.org/D102186
Loading
Please register or sign in to comment