summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/readability-redundant-member-init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/readability-redundant-member-init.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/readability-redundant-member-init.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/readability-redundant-member-init.cpp b/clang-tools-extra/test/clang-tidy/readability-redundant-member-init.cpp
index f15cb1b9d43..90b52fd1a48 100644
--- a/clang-tools-extra/test/clang-tidy/readability-redundant-member-init.cpp
+++ b/clang-tools-extra/test/clang-tidy/readability-redundant-member-init.cpp
@@ -105,6 +105,17 @@ struct F8 : Foo::Template<N_THINGS> {
// CHECK-FIXES: F8() {}
};
+// Anonymous struct
+struct F9 {
+ F9() : s1() {}
+ // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: initializer for member 's1' is redundant
+ // CHECK-FIXES: F9() {}
+ struct {
+ S s1;
+ S s2;
+ };
+};
+
// Initializer not written
struct NF1 {
NF1() {}
@@ -197,3 +208,12 @@ struct NF14 {
NF14() : f() {}
V f;
};
+
+// Anonymous union member
+struct NF15 {
+ NF15() : s1() {}
+ union {
+ S s1;
+ S s2;
+ };
+};
OpenPOWER on IntegriCloud