From bf3a8686ecd6a034af782667b3b11468e60d4953 Mon Sep 17 00:00:00 2001 From: Simon Martin Date: Fri, 12 Sep 2014 21:56:13 +0200 Subject: [PATCH] Ticket #6164: Added test case that now works (failed in 1.66). --- test/testother.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/testother.cpp b/test/testother.cpp index 532df8297..1f8e61fe2 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -1208,6 +1208,15 @@ private: "class MS : public M\n" "{ virtual void addController(C*) override {} };"); ASSERT_EQUALS("", errout.str()); + + // #6164 + checkOldStylePointerCast("class Base {};\n" + "class Derived: public Base {};\n" + "void testCC() {\n" + " std::vector 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) {