From 8df7e6c363a0857e534a9a0561466a2dd7f8d376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Sun, 16 Feb 2025 14:00:21 +0100 Subject: [PATCH] fix #13640 --- lib/tokenlist.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp index 28c13c66331..42b54b0c042 100644 --- a/lib/tokenlist.cpp +++ b/lib/tokenlist.cpp @@ -1582,19 +1582,17 @@ static Token * createAstAtToken(Token *tok) return tok2; } if (Token *const endTok = skipMethodDeclEnding(tok)) { - if (Token::simpleMatch(endTok, "{")) { - Token *tok2 = tok; - do { - tok2 = tok2->next(); - tok2->setCpp11init(false); - if (Token::Match(tok2, "decltype|noexcept (")) { - AST_state state(cpp); - Token *tok3 = tok2->tokAt(2); - compileExpression(tok3, state); - tok2 = tok2->linkAt(1); - } - } while (tok2 != endTok && !precedes(endTok, tok2)); - } + Token *tok2 = tok; + do { + tok2 = tok2->next(); + tok2->setCpp11init(false); + if (Token::Match(tok2, "decltype|noexcept (")) { + AST_state state(cpp); + Token *tok3 = tok2->tokAt(2); + compileExpression(tok3, state); + tok2 = tok2->linkAt(1); + } + } while (tok2 != endTok && !precedes(endTok, tok2)); return endTok; } if (Token::Match(tok, "%type%") && !Token::Match(tok, "return|throw|if|while|new|delete")) {