Fixed recently introduced FP when C-Style casting nullpointers
This commit is contained in:
parent
4c80ca4e8e
commit
4a3d719386
|
@ -499,6 +499,9 @@ void CheckOther::warningOldStylePointerCast()
|
|||
if (tok->strAt(1) == "const")
|
||||
tok = tok->next();
|
||||
|
||||
if (tok->strAt(4) == "0") // Casting nullpointers is safe
|
||||
continue;
|
||||
|
||||
// Is "type" a class?
|
||||
if (_tokenizer->getSymbolDatabase()->isClassOrStruct(tok->strAt(1)))
|
||||
cstyleCastError(tok);
|
||||
|
|
|
@ -1468,6 +1468,12 @@ private:
|
|||
"};");
|
||||
ASSERT_EQUALS("[test.cpp:3]: (style) C-style pointer casting\n", errout.str());
|
||||
|
||||
checkOldStylePointerCast("class SomeType;\n"
|
||||
"class X : public Base {\n"
|
||||
" X() : Base((SomeType*)0) {}\n"
|
||||
"};");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #5560
|
||||
checkOldStylePointerCast("class C;\n"
|
||||
"\n"
|
||||
|
|
Loading…
Reference in New Issue