Skip to content

Commit

Permalink
Update testautovariables.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chrchr-github authored Apr 8, 2024
1 parent 5cec170 commit 2f2e91d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/testautovariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3063,6 +3063,12 @@ class TestAutoVariables : public TestFixture {
ASSERT_EQUALS(
"[test.cpp:4] -> [test.cpp:3] -> [test.cpp:4]: (error) Returning pointer to local variable 'ptr' that will be invalid when returning.\n",
errout_str());

check("struct S { std::unique_ptr<int> p; };\n" // #12600
" int* f(const S* s) {\n"
" return s[0].p.get();\n"
"}\n");
ASSERT_EQUALS("", errout_str());
}
void danglingLifetime() {
check("auto f() {\n"
Expand Down

0 comments on commit 2f2e91d

Please sign in to comment.