You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: clang-tools-extra/test/clang-tidy/checkers/cppcoreguidelines/prefer-member-initializer.cpp
+23Lines changed: 23 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -616,3 +616,26 @@ class Foo {
616
616
#undef INVALID_HANDLE_VALUE
617
617
#undef RGB
618
618
}
619
+
620
+
namespaceGH77684 {
621
+
structS1 {
622
+
// CHECK-MESSAGES: :[[@LINE+1]]:16: warning: 'M' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
623
+
S1() : M{} { M = 0; }
624
+
// CHECK-FIXES: S1() : M{0} { }
625
+
int M;
626
+
};
627
+
structS2 {
628
+
// CHECK-MESSAGES: :[[@LINE+1]]:17: warning: 'M' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
629
+
S2() : M{2} { M = 1; }
630
+
// CHECK-FIXES: S2() : M{1} { }
631
+
int M;
632
+
};
633
+
structT { int a; int b; int c; };
634
+
T v;
635
+
structS3 {
636
+
// CHECK-MESSAGES: :[[@LINE+1]]:21: warning: 'M' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
0 commit comments