Skip to content

Commit 4184c39

Browse files
Fix #14971 [regression] internalError for valid typedef (#8790)
Co-authored-by: chrchr-github <noreply@github.com>
1 parent dfcec18 commit 4184c39

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

lib/tokenize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ namespace {
576576
continue;
577577
if (tok->str() != mNameToken->str())
578578
continue;
579-
if (nBraces > 0 && Token::simpleMatch(tok->next(), ";"))
579+
if (nBraces > 0 && Token::Match(tok->next(), "[;(]"))
580580
continue;
581581
if (Token::Match(tok->previous(), "struct|class|enum|union"))
582582
continue;

test/testsimplifytypedef.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3882,6 +3882,9 @@ class TestSimplifyTypedef : public TestFixture {
38823882

38833883
const char code2[] = "typedef struct { int t; } t;"; // #14966
38843884
ASSERT_EQUALS("struct t { int t ; } ;", tok(code2));
3885+
3886+
const char code3[] = "typedef struct S { S() {} } S;"; // #14971
3887+
ASSERT_EQUALS("struct S { S ( ) { } } ;", tok(code3));
38853888
}
38863889

38873890
void simplifyTypedefFunction1() {

0 commit comments

Comments
 (0)