fix #2600 (segmentation fault of cppcheck ( enum{const} ))
This commit is contained in:
parent
999646fca6
commit
4e1ce93104
|
@ -7845,7 +7845,7 @@ void Tokenizer::simplifyEnum()
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for a variable definition: enum {} x;
|
// check for a variable definition: enum {} x;
|
||||||
if (end->next()->str() != ";")
|
if (end->next() && end->next()->str() != ";")
|
||||||
{
|
{
|
||||||
Token *tempTok = end;
|
Token *tempTok = end;
|
||||||
|
|
||||||
|
|
|
@ -285,6 +285,7 @@ private:
|
||||||
TEST_CASE(enum17); // ticket #2381 (duplicate enums)
|
TEST_CASE(enum17); // ticket #2381 (duplicate enums)
|
||||||
TEST_CASE(enum18); // #2466 (array with same name as enum constant)
|
TEST_CASE(enum18); // #2466 (array with same name as enum constant)
|
||||||
TEST_CASE(enum19); // ticket #2536
|
TEST_CASE(enum19); // ticket #2536
|
||||||
|
TEST_CASE(enum20); // ticket #2600
|
||||||
|
|
||||||
// remove "std::" on some standard functions
|
// remove "std::" on some standard functions
|
||||||
TEST_CASE(removestd);
|
TEST_CASE(removestd);
|
||||||
|
@ -6183,6 +6184,12 @@ private:
|
||||||
ASSERT_EQUALS(";", tok(code, false));
|
ASSERT_EQUALS(";", tok(code, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void enum20() // ticket #2600 segmentation fault
|
||||||
|
{
|
||||||
|
const char code[] = "enum { const }\n";
|
||||||
|
ASSERT_EQUALS(";", tok(code, false));
|
||||||
|
}
|
||||||
|
|
||||||
void removestd()
|
void removestd()
|
||||||
{
|
{
|
||||||
ASSERT_EQUALS("; strcpy ( a , b ) ;", tok("; std::strcpy(a,b);"));
|
ASSERT_EQUALS("; strcpy ( a , b ) ;", tok("; std::strcpy(a,b);"));
|
||||||
|
|
Loading…
Reference in New Issue