From d08d41c7efe3a969ffe06f7d23d91b18aaae7fe3 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 5 Aug 2024 10:41:08 +0200 Subject: [PATCH] Update testautovariables.cpp --- test/testautovariables.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/testautovariables.cpp b/test/testautovariables.cpp index e8d45157225..de74c0e6a8b 100644 --- a/test/testautovariables.cpp +++ b/test/testautovariables.cpp @@ -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 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()); }