diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 27be2e544a2..2d937c6a210 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -572,12 +572,12 @@ namespace { ++nBraces; else if (tok->str() == "}") --nBraces; + if (nBraces > 0) + continue; if (tok == mNameToken) continue; if (tok->str() != mNameToken->str()) continue; - if (nBraces > 0 && Token::Match(tok->next(), "[;(]")) - continue; if (Token::Match(tok->previous(), "struct|class|enum|union")) continue; throw InternalError(tok, "recursive typedef encountered"); diff --git a/test/testsimplifytypedef.cpp b/test/testsimplifytypedef.cpp index 78d7bd25f3d..dbf913c63a4 100644 --- a/test/testsimplifytypedef.cpp +++ b/test/testsimplifytypedef.cpp @@ -3885,6 +3885,9 @@ class TestSimplifyTypedef : public TestFixture { const char code3[] = "typedef struct S { S() {} } S;"; // #14971 ASSERT_EQUALS("struct S { S ( ) { } } ;", tok(code3)); + + const char code4[] = "typedef struct S { S& operator=(const S&) = delete; } S;"; // #14977 + ASSERT_EQUALS("struct S { S & operator= ( const S & ) = delete ; } ;", tok(code4)); } void simplifyTypedefFunction1() {