From 8ff44a7a7f9daffb4024c479f11cc3cb5fda3f6e Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Tue, 11 Aug 2026 18:49:25 +0200 Subject: [PATCH] Fix #14971 [regression] internalError for valid typedef --- lib/tokenize.cpp | 2 +- test/testsimplifytypedef.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 1a6d4a4e53f..27be2e544a2 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -576,7 +576,7 @@ namespace { continue; if (tok->str() != mNameToken->str()) continue; - if (nBraces > 0 && Token::simpleMatch(tok->next(), ";")) + if (nBraces > 0 && Token::Match(tok->next(), "[;(]")) continue; if (Token::Match(tok->previous(), "struct|class|enum|union")) continue; diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index f8e3eb1cdf6..78d7bd25f3d 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -3882,6 +3882,9 @@ class TestSimplifyTypedef : public TestFixture { const char code2[] = "typedef struct { int t; } t;"; // #14966 ASSERT_EQUALS("struct t { int t ; } ;", tok(code2)); + + const char code3[] = "typedef struct S { S() {} } S;"; // #14971 + ASSERT_EQUALS("struct S { S ( ) { } } ;", tok(code3)); } void simplifyTypedefFunction1() {