From 32d7f792ca080dc689fe48a03e16c097a45e9bcf Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 10 Nov 2025 09:36:54 +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 4b01b0fcf97..8acfa5876e1 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -8920,7 +8920,7 @@ void Tokenizer::findGarbageCode() const if (Token::Match(tok, "!|~ %comp%") && !(cpp && tok->strAt(1) == ">" && Token::simpleMatch(tok->tokAt(-1), "operator"))) syntaxError(tok); - if (Token::Match(tok, "] %name%") && (!cpp || !(tok->tokAt(-1) && Token::simpleMatch(tok->tokAt(-2), "delete [")))) { + if (Token::Match(tok, "] %name%") && (!cpp || !(tok->tokAt(1)->isKeyword() || (tok->tokAt(-1) && Token::simpleMatch(tok->tokAt(-2), "delete ["))))) { if (tok->next()->isUpperCaseName()) unknownMacroError(tok->next()); else From 899ddf6a5c4df82e32240b7cf89f79a0a99713a6 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 10 Nov 2025 09:38:14 +0100 Subject: [PATCH 2/2] Update testtokenize.cpp --- test/testtokenize.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 7c7142516fb..97ae9f9b9e3 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -7994,6 +7994,12 @@ class TestTokenizer : public TestFixture { "int main() { \n" " takesFunc([func = [](S s) { return s.c; }] {});\n" "}\n")); + + ASSERT_NO_THROW(tokenizeAndStringify("void f() {\n" // #14256 + " int i = 0;\n" + " auto x = [i] mutable {};\n" + "}\n")); + ignore_errout(); } void checkIfCppCast() {