Skip to content

Commit 6f4ce48

Browse files
committed
Fix FP in constVariable
1 parent 9ece849 commit 6f4ce48

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

lib/astutils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1903,7 +1903,7 @@ bool isVariableChangedByFunctionCall(const Token *tok, int indirect, const Setti
19031903
return false; // not a function => variable not changed
19041904
if (Token::simpleMatch(tok, "{") && isTrivialConstructor(tok))
19051905
return false;
1906-
if (tok->isKeyword() && !isCPPCastKeyword(tok))
1906+
if (tok->isKeyword() && !isCPPCastKeyword(tok) && tok->str().compare(0,8,"operator") != 0)
19071907
return false;
19081908
const Token * parenTok = tok->next();
19091909
if (Token::simpleMatch(parenTok, "<") && parenTok->link())

test/testother.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,6 +1801,13 @@ class TestOther : public TestFixture {
18011801
check(code, &s64);
18021802
ASSERT_EQUALS("", errout.str());
18031803
}
1804+
1805+
check("Writer* getWriter();\n"
1806+
"\n"
1807+
"void foo(Buffer& buffer) {\n"
1808+
" getWriter()->operator<<(buffer);\n"
1809+
"}");
1810+
ASSERT_EQUALS("", errout.str());
18041811
}
18051812

18061813
void passedByValue_externC() {

0 commit comments

Comments
 (0)