[PATCH] D108370: [clang-tidy] Fix wrong FixIt about union in cppcoreguidelines-pro-type-member-init
gehry via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 13 01:26:32 PDT 2021
Sockke added inline comments.
================
Comment at: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp:534
+
+union U2 {
+ U2() {}
----------------
aaron.ballman wrote:
> A related interesting test would be:
> ```
> union U3 {
> U3() {}
>
> struct {
> int B;
> } b;
> int A;
> };
> ```
> I would expect `A` or `b` to need initialization for the union, and `B` to need initialization for the struct.
> A related interesting test would be:
> ```
> union U3 {
> U3() {}
>
> struct {
> int B;
> } b;
> int A;
> };
> ```
> I would expect `A` or `b` to need initialization for the union, and `B` to need initialization for the struct.
I apologize for the delay in responding. It seems to me that `struct {}b` has no user-defined constructor, so all members are initialized to their defaults, it is unnecessary to initialize `B` explicitly.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D108370/new/
https://reviews.llvm.org/D108370
More information about the cfe-commits
mailing list