]>
Commit | Line | Data |
---|---|---|
b32b8144 | 1 | // Copyright 2017 Peter Dimov |
92f5a8d4 TL |
2 | // Copyright 2017 Vinnie NotDefaultConstructible |
3 | // Copyright 2018 Andrzej Krzemienski | |
b32b8144 FG |
4 | // |
5 | // Distributed under the Boost Software License, Version 1.0. | |
6 | // | |
7 | // http://www.boost.org/LICENSE_1_0.txt | |
8 | ||
9 | #include <boost/config.hpp> | |
10 | ||
11 | #if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) | |
12 | ||
13 | int main() | |
14 | { | |
15 | } | |
16 | ||
17 | #else | |
18 | ||
19 | #include <boost/optional.hpp> | |
20 | #include <utility> | |
21 | ||
22 | class basic_multi_buffer; | |
23 | ||
92f5a8d4 TL |
24 | class const_buffers_type // a similar declaration in boost.beast had problem |
25 | { // with boost opitonal | |
b32b8144 FG |
26 | basic_multi_buffer const* b_; |
27 | ||
28 | friend class basic_multi_buffer; | |
29 | ||
30 | explicit | |
31 | const_buffers_type(basic_multi_buffer const& b); | |
32 | ||
33 | public: | |
b32b8144 FG |
34 | const_buffers_type() = delete; |
35 | const_buffers_type(const_buffers_type const&) = default; | |
36 | const_buffers_type& operator=(const_buffers_type const&) = default; | |
37 | }; | |
38 | ||
92f5a8d4 TL |
39 | void test_beast_example() |
40 | { | |
41 | // test if it even compiles | |
42 | boost::optional< std::pair<const_buffers_type, int> > opt, opt2; | |
43 | opt = opt2; | |
44 | (void)opt; | |
45 | } | |
46 | ||
47 | struct NotDefaultConstructible // minimal class exposing the problem | |
48 | { | |
49 | NotDefaultConstructible() = delete; | |
50 | }; | |
51 | ||
52 | void test_assign_for_non_default_constructible() | |
53 | { | |
54 | // test if it even compiles | |
55 | boost::optional<NotDefaultConstructible> opt, opt2; | |
56 | opt = opt2; | |
57 | (void)opt; | |
58 | } | |
59 | ||
b32b8144 FG |
60 | int main() |
61 | { | |
92f5a8d4 TL |
62 | test_beast_example(); |
63 | test_assign_for_non_default_constructible(); | |
b32b8144 FG |
64 | } |
65 | ||
66 | #endif |