Fixed #2547 (segmentation fault of cppcheck)

This commit is contained in:
Robert Reif 2011-02-05 08:59:59 +01:00 committed by Daniel Marjamäki
parent c078d804b9
commit c592ccd35d
2 changed files with 13 additions and 2 deletions

View File

@ -213,7 +213,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
function.isConst = true;
// pure virtual function
if (Token::Match(end, ") const| = 0 ;"))
if (Token::Match(end, ") const| = %any% ;"))
function.isPure = true;
// count the number of constructors
@ -227,7 +227,7 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
// out of line function
if (Token::Match(end, ") const| ;") ||
Token::Match(end, ") const| = 0 ;"))
Token::Match(end, ") const| = %any% ;"))
{
// find the function implementation later
tok = end->next();

View File

@ -190,6 +190,7 @@ private:
TEST_CASE(symboldatabase9); // ticket #2525
TEST_CASE(symboldatabase10); // ticket #2537
TEST_CASE(symboldatabase11); // ticket #2539
TEST_CASE(symboldatabase12); // ticket #2547
}
// Check the operator Equal
@ -5517,6 +5518,16 @@ private:
ASSERT_EQUALS("", errout.str());
}
void symboldatabase12()
{
// ticket #2547 - segmentation fault
checkConst("class foo {\n"
" void bar2 () = __null;\n"
"};\n");
ASSERT_EQUALS("", errout.str());
}
};
REGISTER_TEST(TestClass)