Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/astutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1615,10 +1615,10 @@
return false;

const Token *followTok1 = tok1, *followTok2 = tok2;
while (Token::simpleMatch(followTok1, "::") && followTok1->astOperand2())
followTok1 = followTok1->astOperand2();
while (Token::simpleMatch(followTok1, "::"))
followTok1 = followTok1->astOperand2() ? followTok1->astOperand2() : followTok1->astOperand1();
while (Token::simpleMatch(followTok2, "::") && followTok2->astOperand2())
followTok2 = followTok2->astOperand2();
followTok2 = followTok2->astOperand2() ? followTok2->astOperand2() : followTok2->astOperand1();
Comment thread Fixed
if (isSameConstantValue(macro, followTok1, followTok2))
return true;

Expand Down
4 changes: 4 additions & 0 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6401,6 +6401,10 @@ class TestOther : public TestFixture {
" s.i = o;\n"
"}\n");
ASSERT_EQUALS("", errout_str());

check("int N;\n" // #14234
"void f() { ::N = N; }\n");
ASSERT_EQUALS("[test.cpp:2:16]: (style) Redundant assignment of '::N' to itself. [selfAssignment]\n", errout_str());
}

void trac1132() {
Expand Down
Loading