From 50f6bb5d36a334c55753a5ee8bf36947889354f1 Mon Sep 17 00:00:00 2001 From: PKEuS Date: Mon, 17 Mar 2014 11:50:45 +0100 Subject: [PATCH] Fixed crash #5511. --- lib/tokenize.cpp | 2 +- test/testtokenize.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index fd8cae500..f54eacbe8 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -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 } diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 12cb43b6f..de1c48794 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -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