From 9b5d1f06028535f8d98c7a8eb34130557031e2bf Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 24 Mar 2026 11:42:12 +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 c2ecb907028..2e4662ea755 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 c2cf0fcb1062f38ebc085d68a8442cdcba3c5f26 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 24 Mar 2026 11:44:03 +0100 Subject: [PATCH 2/3] Update testtokenize.cpp --- test/testtokenize.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 6eb47ec5f53..4509e63979c 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -3820,7 +3820,7 @@ class TestTokenizer : public TestFixture { { const char code[] = "template \n" // #14612 - "void f(Fn && fn, Args&&... args) {\n" + "void f(Fn&& fn, Args&&... args) {\n" " static_assert(std::is_invocable_v);\n" "}\n"; SimpleTokenizer tokenizer(settingsDefault, *this); @@ -3830,6 +3830,19 @@ class TestTokenizer : public TestFixture { ASSERT_EQUALS(true, tok1->link() == tok2); ASSERT_EQUALS(true, tok2->link() == tok1); } + + { + const char code[] = "template \n" // #14615 + "void f(Fn&& fn, Args&&... args) {\n" + " constexpr bool b{ std::is_invocable_v };\n" + "}\n"; + SimpleTokenizer tokenizer(settingsDefault, *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 3c9079cd35d1b23778794693cb4880276483d73c Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 24 Mar 2026 11:51:52 +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 4509e63979c..f7437cdf2e4 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -3839,7 +3839,7 @@ class TestTokenizer : public TestFixture { SimpleTokenizer tokenizer(settingsDefault, *this); ASSERT(tokenizer.tokenize(code)); const Token* tok1 = Token::findsimplematch(tokenizer.tokens(), "< Fn"); - const Token* tok2 = Token::findsimplematch(tok1, "> )"); + const Token* tok2 = Token::findsimplematch(tok1, "> }"); ASSERT_EQUALS(true, tok1->link() == tok2); ASSERT_EQUALS(true, tok2->link() == tok1); }