Skip to content

Commit 7e376ed

Browse files
Add a couple of tests for [[clang::lifetimebound]] annotations in libc++
1 parent 67dc3c5 commit 7e376ed

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

libcxx/test/libcxx/utilities/utility/forward/lifetimebound.verify.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
// UNSUPPORTED: c++03
1010
// ADDITIONAL_COMPILE_FLAGS: -Wno-pessimizing-move -Wno-unused-variable
1111

12+
#include <set>
1213
#include <utility>
14+
#include <vector>
1315

1416
#include "test_macros.h"
1517

@@ -25,4 +27,10 @@ void func() {
2527
#if TEST_STD_VER >= 23
2628
auto&& v5 = std::forward_like<int&&>(int{}); // expected-warning {{temporary bound to local reference 'v5' will be destroyed at the end of the full-expression}}
2729
#endif
30+
31+
// expected-warning@+1 {{temporary bound to local reference 'v6' will be destroyed at the end of the full-expression}}
32+
auto&& v6 = std::vector<int>().emplace_back(0);
33+
34+
// expected-warning@+1 {{temporary whose address is used as value of local variable 'v7' will be destroyed at the end of the full-expression}}
35+
auto v7 = std::set<int>().insert(0);
2836
}

0 commit comments

Comments
 (0)