[PATCH] D127293: [clang-tidy] Ignore other members in a union if any member of it is initialized in cppcoreguidelines-pro-type-member-init

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 18 06:19:26 PDT 2022


njames93 added a comment.

Can you add test cases where there is a struct with an anonymous union and another field that does need an initializer, just to verify warning and fixit behaviour.

  struct S3 {
    S3() {}
    int A;
    union {
      int B;
      int C = 0; // Possibly a case where this is initialized in the member init list.
    };
  };



================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:186-188
+- Fixed a false positive in :doc:`cppcoreguidelines-pro-type-member-init
+  <clang-tidy/checks/cppcoreguidelines/pro-type-member-init>` when any member
+  of the anonymous union has been initialized.
----------------
Can't think of the nicest way to say this, but I think this is a little more understandable.


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

https://reviews.llvm.org/D127293



More information about the cfe-commits mailing list