diff --git a/test/testautovariables.cpp b/test/testautovariables.cpp index ef8cd776a2b..a9b68afb1b5 100644 --- a/test/testautovariables.cpp +++ b/test/testautovariables.cpp @@ -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 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"