#2630 (segmentation fault of cppcheck (template <typedef A>)
This commit is contained in:
parent
1de35c168d
commit
afc7fd82ed
|
@ -3449,7 +3449,7 @@ void Tokenizer::setVarId()
|
||||||
{
|
{
|
||||||
again = false;
|
again = false;
|
||||||
|
|
||||||
if (tok2->str() == "const")
|
if (tok2 && tok2->str() == "const")
|
||||||
tok2 = tok2->next();
|
tok2 = tok2->next();
|
||||||
|
|
||||||
while (Token::Match(tok2, "%var% ::"))
|
while (Token::Match(tok2, "%var% ::"))
|
||||||
|
@ -3484,7 +3484,7 @@ void Tokenizer::setVarId()
|
||||||
{
|
{
|
||||||
while (tok2 && (tok2->isName() || tok2->isNumber() || tok2->str() == "*" || tok2->str() == "&" || tok2->str() == ","))
|
while (tok2 && (tok2->isName() || tok2->isNumber() || tok2->str() == "*" || tok2->str() == "&" || tok2->str() == ","))
|
||||||
tok2 = tok2->next();
|
tok2 = tok2->next();
|
||||||
if (tok2->str() == "(")
|
if (tok2 && tok2->str() == "(")
|
||||||
{
|
{
|
||||||
tok2 = tok2->link()->next();
|
tok2 = tok2->link()->next();
|
||||||
if (tok2->str() == "(")
|
if (tok2->str() == "(")
|
||||||
|
|
|
@ -170,6 +170,7 @@ private:
|
||||||
TEST_CASE(varid25);
|
TEST_CASE(varid25);
|
||||||
TEST_CASE(varid26); // ticket #1967 (list of function pointers)
|
TEST_CASE(varid26); // ticket #1967 (list of function pointers)
|
||||||
TEST_CASE(varid27); // Ticket #2280 (same name for namespace and variable)
|
TEST_CASE(varid27); // Ticket #2280 (same name for namespace and variable)
|
||||||
|
TEST_CASE(varid28); // ticket #2630
|
||||||
TEST_CASE(varidFunctionCall1);
|
TEST_CASE(varidFunctionCall1);
|
||||||
TEST_CASE(varidFunctionCall2);
|
TEST_CASE(varidFunctionCall2);
|
||||||
TEST_CASE(varidFunctionCall3);
|
TEST_CASE(varidFunctionCall3);
|
||||||
|
@ -2818,6 +2819,12 @@ private:
|
||||||
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
|
ASSERT_EQUALS(expected, tokenizeDebugListing(code));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void varid28() // ticket #2630 (segmentation fault)
|
||||||
|
{
|
||||||
|
tokenizeDebugListing("template <typedef A>\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void varidFunctionCall1()
|
void varidFunctionCall1()
|
||||||
{
|
{
|
||||||
const std::string code("void f() {\n"
|
const std::string code("void f() {\n"
|
||||||
|
|
Loading…
Reference in New Issue