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 Jan 15, 2025
1 parent 6f989f8 commit d9a9424
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 @@ -3445,6 +3445,14 @@ class TestAutoVariables : public TestFixture {
" *p = 0;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:2] -> [test.cpp:7]: (error) Static variable 'p' will use pointer to local variable 'a'.\n", errout_str());

// #10902
check("void f() {\n"
" static int* x;\n"
" int y;\n"
" x = &y;\n"
"}\n");
ASSERT_EQUALS("[test.cpp:4] -> [test.cpp:3] -> [test.cpp:4]: (error) Static variable 'x' will use pointer to local variable 'y'.\n", errout_str());
}

void danglingLifetimeFunction() {
Expand Down

0 comments on commit d9a9424

Please sign in to comment.