File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,7 +145,7 @@ void CheckClass::constructors()
145145 std::vector<Usage> usage (scope->varlist .size ());
146146
147147 for (const Function &func : scope->functionList ) {
148- if (!( func.hasBody () || func. isDefault () ) || !(func.isConstructor () || func.type == Function::eOperatorEqual))
148+ if (!func.hasBody () || !(func.isConstructor () || func.type == Function::eOperatorEqual))
149149 continue ;
150150
151151 // Bail: If initializer list is not recognized as a variable or type then skip since parsing is incomplete
@@ -159,8 +159,7 @@ void CheckClass::constructors()
159159 clearAllVar (usage);
160160
161161 std::list<const Function *> callstack;
162- if (func.hasBody ())
163- initializeVarList (func, callstack, scope, usage);
162+ initializeVarList (func, callstack, scope, usage);
164163
165164 // Check if any variables are uninitialized
166165 int count = -1 ;
Original file line number Diff line number Diff line change @@ -385,36 +385,13 @@ class TestConstructors : public TestFixture {
385385 ASSERT_EQUALS (" " , errout.str ());
386386 }
387387
388- void simple10 () { // tickets #4388, #9391
388+ void simple10 () { // ticket #4388
389389 check (" class Fred {\n "
390390 " public:\n "
391391 " Fred() = default;\n "
392392 " private:\n "
393393 " int x;\n "
394394 " };" );
395- ASSERT_EQUALS (" [test.cpp:3]: (warning) Member variable 'Fred::x' is not initialized in the constructor.\n " , errout.str ());
396-
397- check (" class Fred {\n "
398- " public:\n "
399- " Fred() = default;\n "
400- " int x;\n "
401- " };" );
402- ASSERT_EQUALS (" [test.cpp:3]: (warning) Member variable 'Fred::x' is not initialized in the constructor.\n " , errout.str ());
403-
404- check (" class Fred {\n "
405- " public:\n "
406- " Fred();\n "
407- " int x;\n "
408- " };\n "
409- " Fred::Fred()=default;" );
410- ASSERT_EQUALS (" [test.cpp:3]: (warning) Member variable 'Fred::x' is not initialized in the constructor.\n " , errout.str ());
411-
412- check (" class Fred {\n "
413- " public:\n "
414- " Fred() = default;\n "
415- " private:\n "
416- " int x = 0;\n "
417- " };" );
418395 ASSERT_EQUALS (" " , errout.str ());
419396 }
420397
You can’t perform that action at this time.
0 commit comments