Fixed #1988 (segmentation fault of cppcheck with wrong syntax of -std=c++0x)
This commit is contained in:
parent
a862e982ff
commit
0d530711f6
|
@ -6646,6 +6646,12 @@ void Tokenizer::simplifyEnum()
|
|||
typeTokenEnd = typeTokenStart;
|
||||
while (Token::Match(typeTokenEnd->next(), "signed|unsigned|char|short|int|long"))
|
||||
typeTokenEnd = typeTokenEnd->next();
|
||||
|
||||
if (!Token::Match(typeTokenEnd->next(), "{|;"))
|
||||
{
|
||||
syntaxError(typeTokenEnd->next());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (tok->tokAt(1)->str() == "{")
|
||||
|
|
|
@ -250,6 +250,7 @@ private:
|
|||
TEST_CASE(enum13);
|
||||
TEST_CASE(enum14);
|
||||
TEST_CASE(enum15);
|
||||
TEST_CASE(enum16); // ticket #1988
|
||||
|
||||
// remove "std::" on some standard functions
|
||||
TEST_CASE(removestd);
|
||||
|
@ -5513,6 +5514,13 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
void enum16() // ticket #1988
|
||||
{
|
||||
const char code[] = "enum D : auto * { FF = 0 };";
|
||||
checkSimplifyEnum(code);
|
||||
ASSERT_EQUALS("[test.cpp:1]: (error) syntax error\n", errout.str());
|
||||
}
|
||||
|
||||
void removestd()
|
||||
{
|
||||
ASSERT_EQUALS("; strcpy ( a , b ) ;", tok("; std::strcpy(a,b);"));
|
||||
|
|
Loading…
Reference in New Issue