Merge pull request #431 from simartin/ticket_6164_test

Ticket #6164: Added test case that now works
This commit is contained in:
amai2012 2014-09-12 22:36:06 +02:00
commit 92bd12a302
1 changed files with 9 additions and 0 deletions

View File

@ -1208,6 +1208,15 @@ private:
"class MS : public M\n" "class MS : public M\n"
"{ virtual void addController(C*) override {} };"); "{ virtual void addController(C*) override {} };");
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
// #6164
checkOldStylePointerCast("class Base {};\n"
"class Derived: public Base {};\n"
"void testCC() {\n"
" std::vector<Base*> v;\n"
" v.push_back((Base*)new Derived);\n"
"}");
ASSERT_EQUALS("[test.cpp:5]: (style) C-style pointer casting\n", errout.str());
} }
void checkInvalidPointerCast(const char code[], bool portability = true, bool inconclusive = false) { void checkInvalidPointerCast(const char code[], bool portability = true, bool inconclusive = false) {