From fbdf7e86735ea098a1f1c9a5a0fb0b4b3502893c Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Wed, 27 May 2026 13:07:55 +0200 Subject: [PATCH 1/2] Update tokenlist.cpp --- lib/tokenlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 6c4cd7eb981..943b00a1e4a 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -609,7 +609,7 @@ static bool iscpp11init_impl(const Token * const tok) if (Token::Match(nameToken, "]|*")) { const Token* tok2 = nameToken; if (tok2->link()) { - while (tok2 && tok2->link()) + while (tok2 && precedes(tok2->link(), nameToken)) tok2 = tok2->link()->previous(); } else From 0ae94b51152762df50708bd92ba89ccaed2db10f Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Wed, 27 May 2026 13:09:55 +0200 Subject: [PATCH 2/2] Update testtokenize.cpp --- test/testtokenize.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index a81130c3114..d0f2740606c 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -8709,6 +8709,10 @@ class TestTokenizer : public TestFixture { "{ 1", Token::Cpp11init::CPP11INIT); + testIsCpp11init("void f() { g([] { if (int x = 1; x) {} }); }", // #14790 + "{ int", + Token::Cpp11init::NOINIT); // don't hang + ASSERT_NO_THROW(tokenizeAndStringify("template struct X {};\n" // don't crash "template auto f(T t) -> X {}\n")); ASSERT_EQUALS("[test.cpp:2:22]: (debug) auto token with no type. [autoNoType]\n", errout_str());