File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ endfunction()
106
106
107
107
add_test (NAME "safecxx-verify-headers" COMMAND "${CMAKE_COMMAND} " --build ${CMAKE_BINARY_DIR} --target "safe_cxx_verify_interface_header_sets" --config $<CONFIG)
108
108
109
+ safe_cxx_compile_fail_test(array1 "use of bi depends on expired loan" )
109
110
safe_cxx_compile_fail_test(string_view1 "use of sv depends on expired loan" )
110
111
safe_cxx_compile_fail_test(box_incomplete "class incomplete is incomplete" )
111
112
safe_cxx_compile_fail_test(box1 "cannot convert prvalue int to std2::box<int>" )
Original file line number Diff line number Diff line change
1
+ // A test for https://github.com/cppalliance/safe-cpp/issues/72
2
+ #feature on safety
3
+ #include < std2.h>
4
+ using namespace std2 ;
5
+
6
+ int main () safe {
7
+ int i = 0 ;
8
+ int j = 1 ;
9
+ vector<const int ^> v { ^const i, ^const j };
10
+
11
+ const int ^ bi = v[0 ];
12
+
13
+ // Mutation of i while the loan in v is live should make this
14
+ // ill-formed.
15
+ i = 1 ;
16
+
17
+ // Keep the loan in scope.
18
+ int x = *bi;
19
+ }
You can’t perform that action at this time.
0 commit comments