Skip to content

Commit 7112cdf

Browse files
committed
review
1 parent e129ca0 commit 7112cdf

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎lib/tokenize.cpp‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2820,8 +2820,9 @@ namespace {
28202820
tok2 = tok2->tokAt(-2);
28212821
}
28222822

2823-
// destructor name, i.e. "~C" in "~C()" or "N::C::~C()"
2824-
if (Token::Match(tok1->previous(), "~ %name% ( )"))
2823+
// qualified destructor name, i.e. "~C" in "C::~C()" or "N::C::~C()"
2824+
// (the unqualified "~C()" inside the class is handled below)
2825+
if (Token::Match(tok1->tokAt(-3), "%name% :: ~ %name% (") && tok1->strAt(-3) == tok1->str())
28252826
return false;
28262827

28272828
// Inside a class the unqualified class name is the injected-class-name,

‎test/testsimplifyusing.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,8 +1073,8 @@ class TestSimplifyUsing : public TestFixture {
10731073
void simplifyUsing46() {
10741074
// alias after unary bitwise not must be replaced
10751075
const char code[] = "using U = unsigned char;\n"
1076-
"unsigned f() { return ~U(0) & ~U{1}; }\n";
1077-
const char expected[] = "unsigned int f ( ) { return ~ unsigned char ( 0 ) & ~ unsigned char { 1 } ; }";
1076+
"unsigned f() { return ~U(0) & ~U{1} & ~U(); }\n";
1077+
const char expected[] = "unsigned int f ( ) { return ~ unsigned char ( 0 ) & ~ unsigned char { 1 } & ~ unsigned char ( ) ; }";
10781078
ASSERT_EQUALS(expected, tok(code));
10791079
ASSERT_EQUALS("", errout_str());
10801080
}

0 commit comments

Comments
 (0)