Skip to content
Commit 78d404a1 authored by Alexandru Octavian Butiu's avatar Alexandru Octavian Butiu Committed by Hans Wennborg
Browse files

[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
parent 00290590
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment