diff --git a/test/testautovariables.cpp b/test/testautovariables.cpp index bdb6f252e..d44c52130 100644 --- a/test/testautovariables.cpp +++ b/test/testautovariables.cpp @@ -64,6 +64,7 @@ private: { TEST_CASE(testautovar); TEST_CASE(testautovararray); + TEST_CASE(testautovarreturn); } @@ -84,6 +85,14 @@ private: "arr[0]=#"); ASSERT_EQUALS(std::string("[test.cpp:3]: (error) Wrong assignement of an auto-variable to an effective parameter of a function\n"), errout.str()); } + void testautovarreturn() + { + check("int* func1()\n" + "{\n" + " int num=2;" + "return #"); + ASSERT_EQUALS(std::string("[test.cpp:3]: (error) Return of the address of an auto-variable\n"), errout.str()); + } }; REGISTER_TEST(TestAutoVariables)