We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bb84926 commit 7a1a378Copy full SHA for 7a1a378
1 file changed
test/testautovariables.cpp
@@ -3947,6 +3947,14 @@ class TestAutoVariables : public TestFixture {
3947
ASSERT_EQUALS(
3948
"[test.cpp:4:12] -> [test.cpp:5:12]: (error) Returning object that will be invalid when returning. [returnDanglingLifetime]\n",
3949
errout_str());
3950
+
3951
+ check("struct A { int x; int& r};\n"
3952
+ "A f(int& r) {\n"
3953
+ " int x = 0;\n"
3954
+ " A a{.x = x, .r = r};\n"
3955
+ " return a;\n"
3956
+ "}\n");
3957
+ ASSERT_EQUALS("", errout_str());
3958
}
3959
3960
void danglingLifetimeInitList() {
0 commit comments