diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 7a0a2e4f5c9..49a29f83848 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3768,7 +3768,7 @@ void Tokenizer::concatenateNegativeNumberAndAnyPositive() if (tok->findOpeningBracket()) continue; - if (!tok->tokAt(2) || (tok->tokAt(2)->isOp() && !Token::Match(tok->tokAt(2), "[+-]"))) + if (!tok->tokAt(2) || (tok->tokAt(2)->isOp() && !Token::Match(tok->tokAt(2), "[+-*]"))) syntaxError(tok); while (tok->str() != ">" && tok->next() && tok->strAt(1) == "+" && (!Token::Match(tok->tokAt(2), "%name% (|;") || Token::Match(tok, "%op%"))) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 8fd143e2fdd..76e8b922f5b 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -8080,6 +8080,10 @@ class TestTokenizer : public TestFixture { " for (int i : [](int a, int b) { ++a; ++b; return std::vector{a, b}; }(1, 2)) {}\n" "}\n")); + ASSERT_NO_THROW(tokenizeAndStringify("void f(int* p) {\n" // #15014 + " *p = -*p;\n" + "}\n")); + ignore_errout(); ASSERT_EQUALS(";", tokenizeAndStringify("typedef std::size_t size_t;\n")); // #14809