From d0ae85d19d45bac44e9183f65b420c481ddde411 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 7 Aug 2026 09:55:54 +0200 Subject: [PATCH 1/2] Update tokenize.cpp --- lib/tokenize.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 033462ca2e2..0076ce30875 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -566,11 +566,18 @@ namespace { const auto checkForRecursion = [this]() { if (Token::Match(mTypedefToken, "typedef %name% %name% ;")) return; + int nBraces = 0; for (const Token *tok = mTypedefToken; tok != mEndToken; tok = tok->next()) { + if (tok->str() == "{") + ++nBraces; + else if (tok->str() == "}") + --nBraces; if (tok == mNameToken) continue; if (tok->str() != mNameToken->str()) continue; + if (nBraces > 0 && Token::simpleMatch(tok->next(), ";")) + continue; if (Token::Match(tok->previous(), "struct|class|enum|union")) continue; throw InternalError(tok, "recursive typedef encountered"); From b6baab23f91794060076cf48968a297a9fd41d20 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Fri, 7 Aug 2026 10:00:42 +0200 Subject: [PATCH 2/2] Update testsimplifytypedef.cpp --- test/testsimplifytypedef.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index e83be343e01..f8e3eb1cdf6 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -3879,6 +3879,9 @@ class TestSimplifyTypedef : public TestFixture { void simplifyTypedef164() { const char code[] = "typedef struct D{x;}y y;"; ASSERT_THROW_INTERNAL(tok(code), INTERNAL); + + const char code2[] = "typedef struct { int t; } t;"; // #14966 + ASSERT_EQUALS("struct t { int t ; } ;", tok(code2)); } void simplifyTypedefFunction1() {