added additional tests to ticket #3862

This commit is contained in:
Ettl Martin 2012-06-04 21:32:11 +02:00
parent 1245abe094
commit c42b21c503
1 changed files with 20 additions and 1 deletions

View File

@ -394,7 +394,8 @@ private:
ASSERT_EQUALS("", errout.str());
}
void return4() {
void return4() { // ticket #3862
// avoid false positives
check("void f(char *p, int x) {\n"
" if (x==12) {n"
" free(p);\n"
@ -403,6 +404,24 @@ private:
" free(p);\n"
"}");
ASSERT_EQUALS("", errout.str());
check("void f(char *p, int x) {\n"
" if (x==12) {n"
" delete p;\n"
" throw 1;\n"
" }\n"
" delete p;\n"
"}");
ASSERT_EQUALS("", errout.str());
check("void f(char *p, int x) {\n"
" if (x==12) {n"
" delete [] p;\n"
" throw 1;\n"
" }\n"
" delete [] p;\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void test1() { // 3809