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() {