Fixed G++ [-Wparentheses] warning. This also fixed #4073 (Crash on self assignment).
This commit is contained in:
parent
41b624230f
commit
2b5cd2effc
|
@ -871,7 +871,7 @@ void CheckOther::switchCaseFallThrough(const Token *tok)
|
|||
//---------------------------------------------------------------------------
|
||||
static bool isTypeWithoutSideEffects(const Tokenizer *tokenizer, const Variable* var)
|
||||
{
|
||||
return ((var && (!var->isClass() || var->isPointer()) || Token::simpleMatch(var->typeStartToken(), "std ::")) || !tokenizer->isCPP());
|
||||
return ((var && (!var->isClass() || var->isPointer() || Token::simpleMatch(var->typeStartToken(), "std ::"))) || !tokenizer->isCPP());
|
||||
}
|
||||
|
||||
void CheckOther::checkSelfAssignment()
|
||||
|
|
|
@ -2309,6 +2309,13 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (warning) Redundant assignment of \"var\" to itself\n", errout.str());
|
||||
|
||||
// #4073 (segmentation fault)
|
||||
check("void Foo::myFunc( int a )\n"
|
||||
"{\n"
|
||||
" if (a == 42)\n"
|
||||
" a = a;\n"
|
||||
"}\n");
|
||||
|
||||
check("void foo()\n"
|
||||
"{\n"
|
||||
" int x = 1;\n"
|
||||
|
|
Loading…
Reference in New Issue