[clang] [Clang] Fix -Wunused-private-field false negative with defaulted comparison operators (PR #116871)
Mészáros Gergely via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 22 09:53:35 PST 2024
https://github.com/Maetveis approved this pull request.
LGTM Thanks!. Can you add a note in the clang release notes here: https://github.com/llvm/llvm-project/blob/d8a1c6d72739c99f4b52a84e907b96b685b44c5e/clang/docs/ReleaseNotes.rst?plain=1#L559
I think this should be good for the text:
```rst
- Fixed a bug where Clang would not emit ``-Wunused-private-field`` warnings when an unrelated class
defined a defaulted comparison operator (#GH116270).
.. code-block:: c++
class A {
private:
int a; // warning: private field 'a' is not used, no diagnostic previously
};
class C {
bool operator==(const C&) = default;
};
```
(If you want to build the clang documentation to check locally, you can follow https://github.com/llvm/llvm-project/blob/main/llvm/docs/README.txt#L11 and replace `docs-llvm-html` with `docs-clang-html`.)
https://github.com/llvm/llvm-project/pull/116871
More information about the cfe-commits
mailing list