You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/testautovariables.cpp
+9Lines changed: 9 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3957,6 +3957,15 @@ class TestAutoVariables : public TestFixture {
3957
3957
"[test.cpp:6:30] -> [test.cpp:6:30] -> [test.cpp:6:21] -> [test.cpp:5:21] -> [test.cpp:8:12]: (error) Returning object that points to local variable 'a' that will be invalid when returning. [returnDanglingLifetime]\n",
3958
3958
errout_str());
3959
3959
3960
+
check("struct S { const std::string& r; };\n"// #14209
3961
+
"S f() {\n"
3962
+
" std::string s;\n"
3963
+
" return S{ s };\n"
3964
+
"}\n");
3965
+
ASSERT_EQUALS(
3966
+
"[test.cpp:4:15] -> [test.cpp:3:17] -> [test.cpp:4:13]: (error) Returning object that points to local variable 's' that will be invalid when returning. [returnDanglingLifetime]\n",
0 commit comments