From ba988cc866ee03412221f8d8319fe9471d9c1142 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 15 Sep 2026 10:47:04 +0200 Subject: [PATCH 1/6] Update tokenize.cpp --- lib/tokenize.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 19c881e7ba5..d67356ad086 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -3774,7 +3774,8 @@ void Tokenizer::concatenateNegativeNumberAndAnyPositive() 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%"))) + while ((tok->isArithmeticalOp() || tok->isComparisonOp()) && tok->str() != ">" && tok->next() && tok->strAt(1) == "+" && + (!Token::Match(tok->tokAt(2), "%name% (|;") || Token::Match(tok, "%op%"))) tok->deleteNext(); if (Token::Match(tok->next(), "+|- %num%")) { From 46221b9543ba12bce82fcb6ef62285ac5b99b011 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 15 Sep 2026 10:48:14 +0200 Subject: [PATCH 2/6] Update testtokenize.cpp --- test/testtokenize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 7a07516b632..4180351880c 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -1104,7 +1104,7 @@ class TestTokenizer : public TestFixture { ASSERT_EQUALS("int f ( ) { return -2 ; }", tokenizeAndStringify("int f(){return -2;}\n")); ASSERT_EQUALS("int x [ 2 ] = { -2 , 1 }", tokenizeAndStringify("int x[2] = {-2,1}\n")); - ASSERT_EQUALS("f ( 123 )", tokenizeAndStringify("f(+123)\n")); + ASSERT_EQUALS("f ( + 123 )", tokenizeAndStringify("f(+123)\n")); ASSERT_EQUALS("std :: extent_v < A > - 1 ;", tokenizeAndStringify("std::extent_v - 1;\n")); // #11341 } From a75525eeaf0281648c754a11c15b2a4b218a9d4f Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 15 Sep 2026 10:49:49 +0200 Subject: [PATCH 3/6] Update testsymboldatabase.cpp --- test/testsymboldatabase.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/testsymboldatabase.cpp b/test/testsymboldatabase.cpp index dfb61665b8a..cbd9eafb8d3 100644 --- a/test/testsymboldatabase.cpp +++ b/test/testsymboldatabase.cpp @@ -546,6 +546,7 @@ class TestSymbolDatabase : public TestFixture { TEST_CASE(findFunction62); // #14272 - pointer passed to function is const TEST_CASE(findFunction63); // #14937 - member function of type returned by operator() TEST_CASE(findFunction64); // overloaded operator() + TEST_CASE(findFunction65); TEST_CASE(findFunctionRef1); TEST_CASE(findFunctionRef2); // #13328 TEST_CASE(findFunctionContainer); @@ -8990,6 +8991,20 @@ class TestSymbolDatabase : public TestFixture { } } + void findFunction65() + { + { + GET_SYMBOL_DB("bool g(char) { return true; }\n" // #15033 + "bool g(int) { return false; }\n" + "void f(char c) {\n" + " if (g(+c)) {}\n" + "}\n"); + const Token* g = Token::findsimplematch(tokenizer.tokens(), "g ( +"); + ASSERT(g && g->function()); + ASSERT_EQUALS(2, g->function()->tokenDef->linenr()); + } + } + void findFunctionRef1() { GET_SYMBOL_DB("struct X {\n" " const std::vector getInts() const & { return mInts; }\n" From 09a315ecc17054a2ba58780cf3b133d2fbc4a0b9 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 15 Sep 2026 10:50:38 +0200 Subject: [PATCH 4/6] Update testvalueflow.cpp --- test/testvalueflow.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 618e16624d8..e0d5290dbd1 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -1837,6 +1837,14 @@ class TestValueFlow : public TestFixture { ASSERT_EQUALS(1U, values.size()); ASSERT_EQUALS(3 * settings.platform.sizeof_int, values.back().intvalue); ASSERT_EQUALS_ENUM(ValueFlow::Value::ValueKind::Known, values.back().valueKind); + + code = "int f(char c) {\n" // #15037 + " return sizeof(+c);\n" + "}\n"; + values = tokenValues(code, "( +"); + ASSERT_EQUALS(1U, values.size()); + ASSERT_EQUALS(settings.platform.sizeof_int, values.back().intvalue); + ASSERT_EQUALS_ENUM(ValueFlow::Value::ValueKind::Known, values.back().valueKind); } void valueFlowComma() From 5d58878c618f1af775a352774d33df60924f611d Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 15 Sep 2026 10:51:48 +0200 Subject: [PATCH 5/6] Update testvalueflow.cpp --- test/testvalueflow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index e0d5290dbd1..301937718f4 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -1838,7 +1838,7 @@ class TestValueFlow : public TestFixture { ASSERT_EQUALS(3 * settings.platform.sizeof_int, values.back().intvalue); ASSERT_EQUALS_ENUM(ValueFlow::Value::ValueKind::Known, values.back().valueKind); - code = "int f(char c) {\n" // #15037 + code = "int f(char c) {\n" // #15033 " return sizeof(+c);\n" "}\n"; values = tokenValues(code, "( +"); From 8f5be87b3d7bbb21d985d4ef5b2d2189a55cbbc8 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 15 Sep 2026 10:57:30 +0200 Subject: [PATCH 6/6] Update testtokenize.cpp --- test/testtokenize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 4180351880c..a25ea9c4bd6 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -1104,7 +1104,7 @@ class TestTokenizer : public TestFixture { ASSERT_EQUALS("int f ( ) { return -2 ; }", tokenizeAndStringify("int f(){return -2;}\n")); ASSERT_EQUALS("int x [ 2 ] = { -2 , 1 }", tokenizeAndStringify("int x[2] = {-2,1}\n")); - ASSERT_EQUALS("f ( + 123 )", tokenizeAndStringify("f(+123)\n")); + ASSERT_EQUALS("f ( +123 )", tokenizeAndStringify("f(+123)\n")); ASSERT_EQUALS("std :: extent_v < A > - 1 ;", tokenizeAndStringify("std::extent_v - 1;\n")); // #11341 }