Skip to content

Commit f25e935

Browse files
committed
new test
1 parent 061ab75 commit f25e935

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎test/testother.cpp‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10086,6 +10086,16 @@ class TestOther : public TestFixture {
1008610086
ASSERT_EQUALS("[test.cpp:2:11]: (style) Variable 'p' can be declared as pointer to const [constVariablePointer]\n"
1008710087
"[test.cpp:3:5]: (error) Mismatching address is deleted. The address you get from new must be deleted without offset. [invalidFree]\n"
1008810088
, errout_str());
10089+
10090+
check("void f() {\n"
10091+
" char *p = new char[2];\n"
10092+
" char *q = p - 1;\n"
10093+
" delete [] (p - 1);\n"
10094+
" (void)q;\n"
10095+
"}\n");
10096+
ASSERT_EQUALS("[test.cpp:2:11]: (style) Variable 'p' can be declared as pointer to const [constVariablePointer]\n"
10097+
"[test.cpp:4:5]: (error) Mismatching address is deleted. The address you get from new must be deleted without offset. [invalidFree]\n",
10098+
errout_str());
1008910099
}
1009010100

1009110101
void checkRedundantCopy() {

0 commit comments

Comments
 (0)