From 21c9b6d262f800b08f610983d7238b3e28f47ed2 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Sat, 20 Aug 2011 16:41:12 -0400 Subject: [PATCH] add another test for #3030 (Improve check: Returning pointer to local array variable with '&' pointer operator) --- test/testautovariables.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/testautovariables.cpp b/test/testautovariables.cpp index a7c833c60..54feb030d 100644 --- a/test/testautovariables.cpp +++ b/test/testautovariables.cpp @@ -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()