fix #2720 (false positive: syntax error with c++0x code)
This commit is contained in:
parent
58dbbb0cab
commit
3159df958d
|
@ -7871,7 +7871,7 @@ void Tokenizer::simplifyEnum()
|
||||||
|
|
||||||
typeTokenStart = tok->tokAt(offset);
|
typeTokenStart = tok->tokAt(offset);
|
||||||
typeTokenEnd = typeTokenStart;
|
typeTokenEnd = typeTokenStart;
|
||||||
while (Token::Match(typeTokenEnd->next(), "signed|unsigned|char|short|int|long"))
|
while (Token::Match(typeTokenEnd->next(), "signed|unsigned|char|short|int|long|const"))
|
||||||
typeTokenEnd = typeTokenEnd->next();
|
typeTokenEnd = typeTokenEnd->next();
|
||||||
|
|
||||||
if (!Token::Match(typeTokenEnd->next(), "{|;"))
|
if (!Token::Match(typeTokenEnd->next(), "{|;"))
|
||||||
|
|
|
@ -300,6 +300,7 @@ private:
|
||||||
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
|
TEST_CASE(enum20); // ticket #2600
|
||||||
|
TEST_CASE(enum21); // ticket #2720
|
||||||
|
|
||||||
// remove "std::" on some standard functions
|
// remove "std::" on some standard functions
|
||||||
TEST_CASE(removestd);
|
TEST_CASE(removestd);
|
||||||
|
@ -6382,6 +6383,13 @@ private:
|
||||||
ASSERT_EQUALS(";", tok(code, false));
|
ASSERT_EQUALS(";", tok(code, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void enum21() // ticket #2720 syntax error
|
||||||
|
{
|
||||||
|
const char code[] = "enum E2 : signed const short { };\n";
|
||||||
|
ASSERT_EQUALS(";", tok(code, false));
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
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