Fixed #4449 (segfault in CheckClass::initializeVarList())
This commit is contained in:
parent
1f87c6d669
commit
07d118dee5
|
@ -356,7 +356,7 @@ bool CheckClass::isBaseClassFunc(const Token *tok, const Scope *scope)
|
||||||
|
|
||||||
void CheckClass::initializeVarList(const Function &func, std::list<std::string> &callstack, const Scope *scope, std::vector<Usage> &usage)
|
void CheckClass::initializeVarList(const Function &func, std::list<std::string> &callstack, const Scope *scope, std::vector<Usage> &usage)
|
||||||
{
|
{
|
||||||
bool initList = true;
|
bool initList = func.type == Function::eConstructor || func.type == Function::eCopyConstructor;
|
||||||
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 != func.functionScope->classEnd; ftok = ftok->next()) {
|
||||||
|
|
|
@ -82,6 +82,7 @@ private:
|
||||||
TEST_CASE(initvar_nocopy3); // ticket #3611
|
TEST_CASE(initvar_nocopy3); // ticket #3611
|
||||||
|
|
||||||
TEST_CASE(initvar_destructor); // No variables need to be initialized in a destructor
|
TEST_CASE(initvar_destructor); // No variables need to be initialized in a destructor
|
||||||
|
TEST_CASE(initvar_func_ret_func_ptr); // ticket #4449
|
||||||
|
|
||||||
TEST_CASE(operatorEqSTL);
|
TEST_CASE(operatorEqSTL);
|
||||||
|
|
||||||
|
@ -944,6 +945,14 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void initvar_func_ret_func_ptr() { // ticket #4449 (segmentation fault)
|
||||||
|
check("class something {\n"
|
||||||
|
" int * ( something :: * process()) () { return 0; }\n"
|
||||||
|
" something() { process(); }\n"
|
||||||
|
"};\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void operatorEqSTL() {
|
void operatorEqSTL() {
|
||||||
check("class Fred\n"
|
check("class Fred\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue