[PATCH] D159083: Clang: Don't warn about unused private fields of types declared maybe_unused

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 29 05:57:15 PDT 2023


aaron.ballman added a comment.

Thank you for working on this! Mostly looks good, but I did have another test request. Also, please be sure to add a release note for the fix.



================
Comment at: clang/test/SemaCXX/warn-unused-private-field.cpp:291-292
+enum [[maybe_unused]] MaybeUnusedEnum {};
+typedef int MaybeUnusedTypedef [[maybe_unused]];
+class C {
+  MaybeUnusedClass c; // no-warning
----------------
Let's try one more thing:
```
template <typename Ty, typename Uy>
class C2 {
  Ty c; // no-warning
  Uy d; // warning
};

class [[maybe_unused]] Good {};
class Bad {};

C2<Good, Bad> c;
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D159083/new/

https://reviews.llvm.org/D159083



More information about the cfe-commits mailing list