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
{{ message }}
Repository navigation
Commit ec82405
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: test/testautovariables.cpp
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -4101,6 +4101,25 @@ class TestAutoVariables : public TestFixture {
4101
4101
ASSERT_EQUALS(
4102
4102
"[test.cpp:8:20] -> [test.cpp:7:9] -> [test.cpp:8:16]: (error) Returning object that points to local variable 'b' that will be invalid when returning. [returnDanglingLifetime]\n",
4103
4103
errout_str());
4104
+
4105
+
// An argument for a parameter without the attribute is still inconclusive
4106
+
check("struct Pair {\n"
4107
+
" Pair(const int& a [[clang::lifetimebound]], const int* b);\n"
4108
+
" const int* a;\n"
4109
+
" const int* b;\n"
4110
+
"};\n"
4111
+
"Pair f1(const int& a) {\n"
4112
+
" int b = 0;\n"
4113
+
" return Pair(a, &b);\n"
4114
+
"}\n"
4115
+
"Pair f2(const int* b) {\n"
4116
+
" int a = 0;\n"
4117
+
" return Pair(a, b);\n"
4118
+
"}\n");
4119
+
ASSERT_EQUALS(
4120
+
"[test.cpp:8:20] -> [test.cpp:8:20] -> [test.cpp:7:9] -> [test.cpp:8:16]: (error, inconclusive) Returning object that points to local variable 'b' that will be invalid when returning. [returnDanglingLifetime]\n"
4121
+
"[test.cpp:12:17] -> [test.cpp:11:9] -> [test.cpp:12:16]: (error) Returning object that points to local variable 'a' that will be invalid when returning. [returnDanglingLifetime]\n",
0 commit comments