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
@@ -1609,6 +1610,15 @@ class TestConstructors : public TestFixture {
1609
1610
ASSERT_EQUALS("", errout_str());
1610
1611
}
1611
1612
}
1613
+
voidinitvar_derived_private_constructor() {
1614
+
check("class B { int i; };\n"
1615
+
"class D : B {\n"
1616
+
" explicit D(int) {}\n"
1617
+
"};\n");
1618
+
ASSERT_EQUALS("[test.cpp:1:1]: (style) The class 'B' does not declare a constructor although it has private member variables which likely require initialization. [noConstructor]\n"
1619
+
"[test.cpp:3:14]: (warning) Member variable 'B::i' is not initialized in the constructor. Maybe it should be initialized directly in the class B? [uninitDerivedMemberVarPrivate]\n",
Copy file name to clipboardExpand all lines: test/testother.cpp
+32Lines changed: 32 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -256,6 +256,8 @@ class TestOther : public TestFixture {
256
256
TEST_CASE(raceAfterInterlockedDecrement);
257
257
258
258
TEST_CASE(testUnusedLabel);
259
+
TEST_CASE(testUnusedLabelConfiguration);
260
+
TEST_CASE(testUnusedLabelSwitchConfiguration);
259
261
260
262
TEST_CASE(testEvaluationOrder);
261
263
TEST_CASE(testEvaluationOrderSelfAssignment);
@@ -11794,6 +11796,36 @@ class TestOther : public TestFixture {
11794
11796
ASSERT_EQUALS("[test.cpp:6:5]: (style) Label 'label' is not used. [unusedLabel]\n", errout_str());
11795
11797
}
11796
11798
11799
+
11800
+
void testUnusedLabelConfiguration() {
11801
+
checkP("void f() {\n"
11802
+
"#ifdef X\n"
11803
+
" goto END;\n"
11804
+
"#endif\n"
11805
+
"END:\n"
11806
+
"}");
11807
+
ASSERT_EQUALS("[test.cpp:5:1]: (style) Label 'END' is not used. There is #if in function body so the label might be used in code that is removed by the preprocessor. [unusedLabelConfiguration]\n",
11808
+
errout_str());
11809
+
}
11810
+
11811
+
void testUnusedLabelSwitchConfiguration() {
11812
+
checkP("void f(int i) {\n"
11813
+
" switch (i) {\n"
11814
+
" default:\n"
11815
+
" break;\n"
11816
+
"#ifdef X\n"
11817
+
" case 1:\n"
11818
+
" goto END;\n"
11819
+
"#endif\n"
11820
+
" case 2:\n"
11821
+
" END:\n"
11822
+
" return;\n"
11823
+
" }\n"
11824
+
"}");
11825
+
ASSERT_EQUALS("[test.cpp:10:5]: (warning) Label 'END' is not used. There is #if in function body so the label might be used in code that is removed by the preprocessor. Should this be a 'case' of the enclosing switch()? [unusedLabelSwitchConfiguration]\n",
0 commit comments