[all-commits] [llvm/llvm-project] 78d404: [clang][c++20] Fix false warning for unused privat...
Hans via All-commits
all-commits at lists.llvm.org
Tue Jun 22 09:41:03 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 78d404a11dd33c8349fd9b6ef5876d523c457f0e
https://github.com/llvm/llvm-project/commit/78d404a11dd33c8349fd9b6ef5876d523c457f0e
Author: Alexandru Octavian Butiu <alexandru.octavian.butiu at gmail.com>
Date: 2021-06-22 (Tue, 22 Jun 2021)
Changed paths:
M clang/lib/Sema/SemaDeclCXX.cpp
M clang/test/SemaCXX/warn-unused-private-field.cpp
Log Message:
-----------
[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
More information about the All-commits
mailing list