From 6b9323055a108e42ba4f89187689ed00a05857be Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 19 Mar 2026 09:24:54 +0100 Subject: [PATCH 1/3] 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 a371df76e5d..20e3c6231f5 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5544,7 +5544,7 @@ void Tokenizer::createLinks2() while (!type.empty() && type.top()->str() == "<") { const Token* end = type.top()->findClosingBracket(); - if (Token::Match(end, "> %comp%|;|.|=|{|(|::")) + if (Token::Match(end, "> %comp%|;|.|=|{|(|)|::")) break; // Variable declaration if (Token::Match(end, "> %var% ;") && (type.top()->tokAt(-2) == nullptr || Token::Match(type.top()->tokAt(-2), ";|}|{"))) From c58ad5692a251e7e4fdbcf9fb042fdc535031b84 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 19 Mar 2026 09:27:06 +0100 Subject: [PATCH 2/3] Update testtokenize.cpp --- test/testtokenize.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 16c9335dce7..c74a6734964 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -3829,6 +3829,19 @@ class TestTokenizer : public TestFixture { ASSERT_EQUALS(true, tok1->link() == tok2); ASSERT_EQUALS(true, tok2->link() == tok1); } + + { + const char code[] = "template \n" // #14612 + "void f(Fn && fn, Args&&... args) {\n" + " static_assert(std::is_invocable_v);\n" + "}\n"; + SimpleTokenizer tokenizer(settings0, *this); + ASSERT(tokenizer.tokenize(code)); + const Token* tok1 = Token::findsimplematch(tokenizer.tokens(), "< Fn"); + const Token* tok2 = Token::findsimplematch(tok1, "> )"); + ASSERT_EQUALS(true, tok1->link() == tok2); + ASSERT_EQUALS(true, tok2->link() == tok1); + } } void simplifyString() { From 7b22504dd2b4df2c847f8f5dbcc4109c0aeaaa55 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 19 Mar 2026 09:47:35 +0100 Subject: [PATCH 3/3] 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 c74a6734964..dea8d08e57f 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -3829,7 +3829,7 @@ class TestTokenizer : public TestFixture { ASSERT_EQUALS(true, tok1->link() == tok2); ASSERT_EQUALS(true, tok2->link() == tok1); } - + { const char code[] = "template \n" // #14612 "void f(Fn && fn, Args&&... args) {\n"