File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,7 @@ class TestConstructors : public TestFixture {
172
172
TEST_CASE (uninitVar33); // ticket #10295
173
173
TEST_CASE (uninitVar34); // ticket #10841
174
174
TEST_CASE (uninitVar35);
175
+ TEST_CASE (uninitVar36);
175
176
TEST_CASE (uninitVarEnum1);
176
177
TEST_CASE (uninitVarEnum2); // ticket #8146
177
178
TEST_CASE (uninitVarStream);
@@ -3020,6 +3021,16 @@ class TestConstructors : public TestFixture {
3020
3021
ASSERT_EQUALS (" " , errout_str ());
3021
3022
}
3022
3023
3024
+ void uninitVar36 () {
3025
+ check (" struct S {\n "
3026
+ " unsigned int a : 16;\n "
3027
+ " unsigned int : 8;\n "
3028
+ " unsigned int b : 8;\n "
3029
+ " S() : a(0) {}\n "
3030
+ " };\n " );
3031
+ ASSERT_EQUALS (" [test.cpp:5:5]: (warning) Member variable 'S::b' is not initialized in the constructor. [uninitMemberVar]\n " , errout_str ());
3032
+ }
3033
+
3023
3034
void uninitVarArray1 () {
3024
3035
check (" class John\n "
3025
3036
" {\n "
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ class TestUnusedVar : public TestFixture {
70
70
TEST_CASE (structmember25);
71
71
TEST_CASE (structmember26); // #13345
72
72
TEST_CASE (structmember27); // #13367
73
+ TEST_CASE (structmember28);
73
74
TEST_CASE (structmember_macro);
74
75
TEST_CASE (structmember_template_argument); // #13887 - do not report that member used in template argument is unused
75
76
TEST_CASE (classmember);
@@ -1998,6 +1999,14 @@ class TestUnusedVar : public TestFixture {
1998
1999
errout_str ());
1999
2000
}
2000
2001
2002
+ void structmember28 () {
2003
+ checkStructMemberUsage (" struct S {\n "
2004
+ " unsigned int a : 16;\n "
2005
+ " unsigned int : 16;\n "
2006
+ " };\n " );
2007
+ ASSERT_EQUALS (" [test.cpp:2:18]: (style) struct member 'S::a' is never used. [unusedStructMember]\n " , errout_str ());
2008
+ }
2009
+
2001
2010
void structmember_macro () {
2002
2011
checkStructMemberUsageP (" #define S(n) struct n { int a, b, c; };\n "
2003
2012
" S(unused);\n " );
You can’t perform that action at this time.
0 commit comments