add another test for #3030 (Improve check: Returning pointer to local array variable with '&' pointer operator)
This commit is contained in:
parent
7eb43bc107
commit
21c9b6d262
|
@ -279,6 +279,13 @@ private:
|
||||||
" return &q[1];\n"
|
" return &q[1];\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("[test.cpp:4]: (error) Return of the address of an auto-variable\n", errout.str());
|
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()
|
void testautovar_extern()
|
||||||
|
|
Loading…
Reference in New Issue