add another test for #3030 (Improve check: Returning pointer to local array variable with '&' pointer operator)

This commit is contained in:
Robert Reif 2011-08-20 16:41:12 -04:00
parent 7eb43bc107
commit 21c9b6d262
1 changed files with 7 additions and 0 deletions

View File

@ -279,6 +279,13 @@ private:
" return &q[1];\n"
"}");
ASSERT_EQUALS("[test.cpp:4]: (error) Return of the address of an auto-variable\n", errout.str());
check("char *foo()\n"
"{\n"
" static char q[] = \"AAAAAAAAAAAA\";\n"
" return &q[1];\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void testautovar_extern()