diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 1820ba45..45c35243 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -18,6 +18,7 @@ import testing ; { test-suite optional : [ run optional_test.cpp ] + [ run optional_test_braces.cpp ] [ run optional_test_swap.cpp ] [ run optional_test_conversions_from_U.cpp ] [ run optional_test_convert_from_T.cpp ] diff --git a/test/optional_test_braces.cpp b/test/optional_test_braces.cpp new file mode 100644 index 00000000..b9d14a7d --- /dev/null +++ b/test/optional_test_braces.cpp @@ -0,0 +1,51 @@ +// Copyright (C) 2016 Jürgen Hunold +// +// Use, modification, and distribution is subject to the Boost Software +// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/lib/optional for documentation. + + +#include "boost/optional/optional.hpp" + +#include + +#include "boost/core/lightweight_test.hpp" + +using boost::optional; + + +struct Init +{ + Init(int,double); +}; + +#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + + +template +void test_brace_init() +{ + optional o = {1, 1.1}; + BOOST_TEST(o); +} + +template +void test_brace_assign() +{ + optional o; + o = {1, 1.1}; + BOOST_TEST(o); +} +#endif + +int main() +{ +#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + test_brace_init(); + test_brace_assign(); +#endif + + return boost::report_errors(); +}