If a union member is initialized, the other members of the union are still suggested to be initialized in this check. This patch fixes this behavior.
Reference issue: https://github.com/llvm/llvm-project/issues/54748
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines-pro-type-member-init.cpp | ||
---|---|---|
558 ↗ | (On Diff #435106) | This line is redundant and likely to cause unintended test failures, same goes below. |
Clang-Tidy tests and docs have moved to module subdirectories.
Please rebase this onto main:HEAD and:
- fold your changes into the appropriate subdirs, stripping the module prefix from new files.
- make the target check-clang-extra to validate your tests
- make the target docs-clang-tools-html to validate any docs changes
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. }; };
clang-tools-extra/docs/ReleaseNotes.rst | ||
---|---|---|
137–139 | Can't think of the nicest way to say this, but I think this is a little more understandable. |
Added test cases where there is a struct with an anonymous union and another field that does need an initializer.
LGTM, You'd need to rebase before landing as the release notes have been reset for the 15 release branching.
Hi @Sockke - this seems to be ready to land. Is there something holding it back? We ran into the same issue recently.
This patch has been around for a long time, I have added the release notes. There are users waiting for this fix and I committed it myself first.
@LegalizeAdulthood I'm looking forward to your follow-up reply.
Can't think of the nicest way to say this, but I think this is a little more understandable.