Skip to content

Commit

Permalink
Update testautovariables.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github committed Aug 5, 2024
1 parent 7fdcb3d commit d08d41c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/testautovariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3047,6 +3047,14 @@ class TestAutoVariables : public TestFixture {
"}\n");
ASSERT_EQUALS(
"[test.cpp:4] -> [test.cpp:4] -> [test.cpp:6]: (error) Using object that points to local variable 'v' that is out of scope.\n",
errout_str());

check("std::span<const int> f() {\n" // #12966
" int a[10]{};\n"
" return a;\n"
"}\n");
ASSERT_EQUALS(
"[test.cpp:3] -> [test.cpp:2] -> [test.cpp:3]: (error) Returning pointer to local variable 'a' that will be invalid when returning.\n",
errout_str());
}

Expand Down

0 comments on commit d08d41c

Please sign in to comment.