diff --git a/testbufferoverrun.cpp b/testbufferoverrun.cpp index bb2ebc05b..c346a196e 100644 --- a/testbufferoverrun.cpp +++ b/testbufferoverrun.cpp @@ -1,4 +1,4 @@ -/* +/* * c++check - c/c++ syntax checking * Copyright (C) 2007 Daniel Marjamäki * @@ -62,6 +62,9 @@ private: TEST_CASE( noerr2 ); TEST_CASE( noerr3 ); + // Todo: Fix this. + //TEST_CASE( noerr4 ); + TEST_CASE( array_index_1 ); TEST_CASE( array_index_2 ); TEST_CASE( array_index_3 ); @@ -131,6 +134,18 @@ private: } + void noerr4() + { + // The memory isn't read or written and therefore there is no error. + check( "static void f()\n" + "{\n" + " char data[100];\n" + " const char *p = &data[100];\n" + "}\n" ); + ASSERT_EQUALS( std::string(""), errout.str() ); + } + + void array_index_1() { check("void f()\n"