From 5a444f764bee26ff594d49e2d3e424c96a5a37ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Thu, 22 Mar 2018 15:20:37 +0100 Subject: [PATCH] Fixed one more syntax error FP related to #8390 --- lib/tokenize.cpp | 9 +++++---- test/testgarbage.cpp | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index e1fed19a6..2fe0b07a3 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -8398,10 +8398,11 @@ void Tokenizer::findGarbageCode() const if (!templateEndToken) { if (tok->str() == "<" && isCPP()) templateEndToken = tok->findClosingBracket(); - } else if (templateEndToken == tok) { - templateEndToken = nullptr; - } else if (Token::Match(tok, "> %cop%")) { - continue; + } else { + if (templateEndToken == tok) + templateEndToken = nullptr; + if (Token::Match(tok, "> %cop%")) + continue; } if (Token::Match(tok, "%cop%|=|,|[ %or%|%oror%|/|%")) syntaxError(tok); diff --git a/test/testgarbage.cpp b/test/testgarbage.cpp index ae2c64b90..21f352e85 100644 --- a/test/testgarbage.cpp +++ b/test/testgarbage.cpp @@ -1457,6 +1457,7 @@ private: ASSERT_THROW(checkCode(inp), InternalError); checkCode("template struct S : A< B || C > {};"); // No syntax error: #8390 + checkCode("static_assert(A || B, ab);"); } void garbageCode188() { // #8255