Fixed crash #5511.
This commit is contained in:
parent
86e6bb430a
commit
50f6bb5d36
|
@ -7369,7 +7369,7 @@ void Tokenizer::simplifyEnum()
|
|||
if (tok->next()->str() == ":") {
|
||||
tok = tok->next();
|
||||
|
||||
if (!tok->next()) {
|
||||
if (!tok->next() || !tok->next()->isName()) {
|
||||
syntaxError(tok);
|
||||
return; // can't recover
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ private:
|
|||
TEST_CASE(garbageCode5); // #5168
|
||||
TEST_CASE(garbageCode6); // #5214
|
||||
TEST_CASE(garbageCode7);
|
||||
TEST_CASE(garbageCode8); // #5511
|
||||
|
||||
TEST_CASE(simplifyFileAndLineMacro); // tokenize "return - __LINE__;"
|
||||
|
||||
|
@ -1025,6 +1026,10 @@ private:
|
|||
tokenizeAndStringify("foo(Args&&...) fn void = { } auto template<typename... bar(Args&&...)", /*simplify=*/true);
|
||||
}
|
||||
|
||||
void garbageCode8() {
|
||||
tokenizeAndStringify("{ enum struct : };", true);
|
||||
}
|
||||
|
||||
void simplifyFileAndLineMacro() { // tokenize 'return - __LINE__' correctly
|
||||
ASSERT_EQUALS("\"test.cpp\"", tokenizeAndStringify("__FILE__"));
|
||||
ASSERT_EQUALS("return -1 ;", tokenizeAndStringify("return - __LINE__;"));
|
||||
|
|
Loading…
Reference in New Issue