diff --git a/src/checkother.h b/src/checkother.h index 48ed50349..f75ac02e9 100644 --- a/src/checkother.h +++ b/src/checkother.h @@ -52,6 +52,7 @@ public: checkOther.warningOldStylePointerCast(); checkOther.checkUnsignedDivision(); checkOther.checkCharVariable(); + checkOther.nullPointer(); } } @@ -75,7 +76,6 @@ public: checkOther.strPlusChar(); checkOther.invalidFunctionUsage(); - checkOther.nullPointer(); checkOther.checkZeroDivision(); } diff --git a/src/tokenize.cpp b/src/tokenize.cpp index cb66adf99..ed1041a37 100644 --- a/src/tokenize.cpp +++ b/src/tokenize.cpp @@ -499,6 +499,8 @@ bool Tokenizer::tokenize(std::istream &code, const char FileName[]) } } + setVarId(); + return true; } //--------------------------------------------------------------------------- diff --git a/test/testother.cpp b/test/testother.cpp index 4a8e41ecd..7a116b4e5 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -519,8 +519,6 @@ private: Tokenizer tokenizer; std::istringstream istr(code); tokenizer.tokenize(istr, "test.cpp"); - tokenizer.simplifyTokenList(); - tokenizer.setVarId(); // Clear the error buffer.. errout.str(""); @@ -669,6 +667,15 @@ private: " while (a > 0);\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + // dynamic_cast.. + checkNullPointer("void foo(ABC *abc)\n" + "{\n" + " int a = abc->a;\n" + " if (!dynamic_cast(abc))\n" + " ;\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } // Dereferencing a pointer and then checking if it is null