Fixed #4806 (Crash in Type::initBaseInfo() in clang testcode)

This commit is contained in:
Alexander Mai 2013-06-16 21:46:01 +02:00 committed by Daniel Marjamäki
parent 38ecdda076
commit 0be1892b92
2 changed files with 9 additions and 1 deletions

View File

@ -1481,7 +1481,8 @@ const Token *Type::initBaseInfo(const Token *tok, const Token *tok1)
// save pattern for base class name
derivedFrom.push_back(base);
}
tok2 = tok2->next();
if (tok2) // see #4806
tok2 = tok2->next();
}
return tok2;

View File

@ -192,6 +192,7 @@ private:
TEST_CASE(symboldatabase31);
TEST_CASE(symboldatabase33); // ticket #4682 (false negatives)
TEST_CASE(symboldatabase34); // ticket #4694 (segmentation fault)
TEST_CASE(symboldatabase35); // ticket #4806 (segmentation fault)
TEST_CASE(isImplicitlyVirtual);
@ -1506,6 +1507,12 @@ private:
ASSERT_EQUALS("", errout.str());
}
void symboldatabase35() { // ticket #4806 and #4841
check("class FragmentQueue : public CL_NS(util)::PriorityQueue<CL_NS(util)::Deletor::Object<TextFragment> >\n"
"{};");
ASSERT_EQUALS("", errout.str());
}
void isImplicitlyVirtual() {
{
GET_SYMBOL_DB("class Base {\n"