1// RUN: %check_clang_tidy -std=c++98-or-later %s bugprone-tagged-union-member-count %t \
2// RUN: -config='{CheckOptions: { \
3// RUN: bugprone-tagged-union-member-count.StrictMode: true, \
4// RUN: }}' --
5
6// CHECK-MESSAGES: :[[@LINE+1]]:8: warning: tagged union has fewer data members (2) than tags (3)
7struct IncorrectBecauseStrictmodeIsEnabled {
8 enum {
9 tags1,
10 tags2,
11 tags3,
12 } Tags;
13 union {
14 char A;
15 short B;
16 } Data;
17};
18
19struct Correct { // No warnings expected
20 enum {
21 tags1,
22 tags2,
23 tags3,
24 } Tags;
25 union {
26 char A;
27 short B;
28 int C;
29 } Data;
30};
31

source code of clang-tools-extra/test/clang-tidy/checkers/bugprone/tagged-union-member-count-strictmode-is-enabled.cpp