#5641 fix crash within CheckClass::initializeVarList()
This commit is contained in:
parent
0788e64eb8
commit
173a2e9ea2
|
@ -435,7 +435,7 @@ void CheckClass::initializeVarList(const Function &func, std::list<const Functio
|
||||||
bool initList = func.isConstructor();
|
bool initList = func.isConstructor();
|
||||||
const Token *ftok = func.arg->link()->next();
|
const Token *ftok = func.arg->link()->next();
|
||||||
int level = 0;
|
int level = 0;
|
||||||
for (; ftok != func.functionScope->classEnd; ftok = ftok->next()) {
|
for (; ftok && ftok != func.functionScope->classEnd; ftok = ftok->next()) {
|
||||||
// Class constructor.. initializing variables like this
|
// Class constructor.. initializing variables like this
|
||||||
// clKalle::clKalle() : var(value) { }
|
// clKalle::clKalle() : var(value) { }
|
||||||
if (initList) {
|
if (initList) {
|
||||||
|
|
|
@ -162,6 +162,7 @@ private:
|
||||||
TEST_CASE(uninitVarOperatorEqual); // ticket #2415
|
TEST_CASE(uninitVarOperatorEqual); // ticket #2415
|
||||||
TEST_CASE(uninitVarPointer); // ticket #3801
|
TEST_CASE(uninitVarPointer); // ticket #3801
|
||||||
TEST_CASE(uninitConstVar);
|
TEST_CASE(uninitConstVar);
|
||||||
|
TEST_CASE(constructors_crash1); // ticket #5641
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2901,6 +2902,16 @@ private:
|
||||||
"};");
|
"};");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ticket #5641 "Regression. Crash for 'C() _STLP_NOTHROW {}'"
|
||||||
|
void constructors_crash1() {
|
||||||
|
check("class C {\n"
|
||||||
|
"public:\n"
|
||||||
|
" C() _STLP_NOTHROW {}\n"
|
||||||
|
" C(const C&) _STLP_NOTHROW {}\n"
|
||||||
|
"};\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
REGISTER_TEST(TestConstructors)
|
REGISTER_TEST(TestConstructors)
|
||||||
|
|
Loading…
Reference in New Issue