]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright 2010, Niels Dekker. |
2 | // | |
3 | // Distributed under the Boost Software License, Version 1.0. (See | |
4 | // accompanying file LICENSE_1_0.txt or copy at | |
5 | // http://www.boost.org/LICENSE_1_0.txt) | |
6 | // | |
7 | // Test program for boost::initialized<T>. Must fail to compile. | |
8 | // | |
9 | // Initial: 2 May 2010 | |
10 | ||
11 | #include <boost/utility/value_init.hpp> | |
12 | ||
13 | namespace | |
14 | { | |
15 | void from_value_initialized_to_initialized() | |
16 | { | |
17 | boost::value_initialized<int> value_initialized_int; | |
18 | ||
19 | // Okay: initialized<T> can be initialized by value_initialized<T>. | |
20 | boost::initialized<int> initialized_int(value_initialized_int); | |
21 | } | |
22 | ||
23 | void from_initialized_to_value_initialized() | |
24 | { | |
25 | boost::initialized<int> initialized_int(13); | |
26 | ||
27 | // The following line should not compile, because initialized<T> | |
28 | // should not be convertible to value_initialized<T>. | |
29 | boost::value_initialized<int> value_initialized_int(initialized_int); | |
30 | } | |
31 | } | |
32 | ||
33 | int main() | |
34 | { | |
35 | // This should fail to compile, so there is no need to call any function. | |
36 | return 0; | |
37 | } |