1 // Copyright (C) 2016 Andrzej Krzemienski.
2 //
3 // Use, modification, and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // See http://www.boost.org/lib/optional for documentation.
8 //
9 // You are welcome to contact the author at:
10 //  [email protected]
11 
12 #include "boost/optional/optional.hpp"
13 
14 #ifdef BOOST_BORLANDC
15 #pragma hdrstop
16 #endif
17 
18 #include "boost/core/lightweight_test.hpp"
19 
20 //#ifndef BOOST_OPTIONAL_NO_CONVERTING_ASSIGNMENT
21 //#ifndef BOOST_OPTIONAL_NO_CONVERTING_COPY_CTOR
22 
23 using boost::optional;
24 
25 struct Value
26 {
ValueValue27   explicit Value(int) {}
28 };
29 
30 #ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
31 template <typename T>
test_brace_init()32 void test_brace_init()
33 {
34   optional<T> o = {};
35   BOOST_TEST(!o);
36 }
37 
38 template <typename T>
test_brace_assign()39 void test_brace_assign()
40 {
41   optional<T> o;
42   o = {};
43   BOOST_TEST(!o);
44 }
45 #endif
46 
main()47 int main()
48 {
49 #ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
50   test_brace_init<int>();
51   test_brace_init<Value>();
52   test_brace_assign<int>();
53   test_brace_assign<Value>();
54 #endif
55 
56   return boost::report_errors();
57 }
58