From 2300a76c17ae8505366d168a5fffc08a82a9aa78 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 12 Jan 2026 10:48:59 +0100 Subject: [PATCH 1/2] Update tokenize.cpp --- lib/tokenize.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 7cb080e071f..40dc4c88a4e 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -4254,7 +4254,7 @@ static bool setVarIdParseDeclaration(Token*& tok, const VariableMap& variableMap { const Token* const tok1 = tok; Token* tok2 = tok; - if (!tok2->isName()) + if (!tok2->isName() || (tok2->tokType() != Token::eType && tok2->tokType() != Token::eName && tok2->tokType() != Token::eKeyword)) return false; nonneg int typeCount = 0; From b7dcb1646d4534c048b0e546b7a9380d7eee6cee Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 12 Jan 2026 10:50:29 +0100 Subject: [PATCH 2/2] Update testvarid.cpp --- test/testvarid.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/testvarid.cpp b/test/testvarid.cpp index 6f1ea052abe..de8a58cfa61 100644 --- a/test/testvarid.cpp +++ b/test/testvarid.cpp @@ -101,6 +101,7 @@ class TestVarID : public TestFixture { TEST_CASE(varid69); TEST_CASE(varid70); // #12660 - function TEST_CASE(varid71); // #12676 - wrong varid in uninstantiated templated constructor + TEST_CASE(varid72); TEST_CASE(varid_for_1); TEST_CASE(varid_for_2); TEST_CASE(varid_for_3); @@ -1399,6 +1400,12 @@ class TestVarID : public TestFixture { ASSERT_EQUALS(expected, tokenize(code)); } + void varid72() { + const char code1[] = "static_assert(true && true);\n"; // #14386 + const char expected1[] = "1: static_assert ( true && true ) ;\n"; + ASSERT_EQUALS(expected1, tokenize(code1)); + } + void varid_for_1() { const char code[] = "void foo(int a, int b) {\n" " for (int a=1,b=2;;) {}\n"