Skip to content

Commit 0ae61d6

Browse files
committed
fix #65
1 parent 1359900 commit 0ae61d6

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Diff for: libsafecxx/single-header/std2.h

+2
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,8 @@ box
827827
{
828828
}
829829

830+
box(box const^) = delete;
831+
830832
[[unsafe::drop_only(T)]]
831833
~box() safe {
832834
delete p_;

Diff for: libsafecxx/test/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ add_test(NAME "safecxx-verify-headers" COMMAND "${CMAKE_COMMAND}" --build ${CMAK
109109
safe_cxx_compile_fail_test(string_view1 "use of sv depends on expired loan")
110110
safe_cxx_compile_fail_test(box_incomplete "class incomplete is incomplete")
111111
safe_cxx_compile_fail_test(box1 "cannot convert prvalue int to std2::box<int>")
112+
safe_cxx_compile_fail_test(box2 "call to deleted borrow constructor")
112113
safe_cxx_compile_fail_test(arc1 "cannot convert prvalue int to std2::arc<int>")
113114
safe_cxx_compile_fail_test(rc1 "cannot convert prvalue int to std2::rc<int>")
114115
safe_cxx_compile_fail_test(unsafe_cell1 "cannot convert prvalue std2::box<int> to std2::unsafe_cell<std2::box<int>>")

Diff for: libsafecxx/test/compile-fail/box2.cxx

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2024 Christian Mazakas
2+
// Distributed under the Boost Software License, Version 1.0. (See accompanying
3+
// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4+
5+
#feature on safety
6+
7+
#include <std2.h>
8+
9+
int main()
10+
{
11+
std2::box<int> p(1234);
12+
auto p2 = cpy p;
13+
}

0 commit comments

Comments
 (0)