Compare commits

...

18 Commits

Author SHA1 Message Date
a192204b41 Merge branch 'develop' 2018-11-08 18:49:34 +01:00
545fd9a72f docs and tests fixes 2018-11-08 18:46:03 +01:00
29b2dae630 Merge branch 'Lastique-fix_constructible_from_any' into develop 2018-11-05 18:18:05 +01:00
2f3cf1ca84 Added a test to verify that boost::optional copy constructor does not invoke T's template constructors. 2018-11-04 17:54:57 +03:00
24d29e5865 Fix for clang, when adapted type is convertible from other types.
The problem was with copy/move constructors of boost::optional<T>, which invoked
optional_base<T> constructors with a single argument. Since optional_base has
copy/move constructors along with initializing constructors taking a single
argument, the latter may be considered by the compiler for viability. While
doing so, the compiler may instantiate the template constructor of T with
an argument of optional_base<T>, which in turn may fail if the constructor
attempts to inspect the type of its argument (e.g. to constrain the set of
acceptable types). Specifically, this happens with clang in C++03 mode,
when boost::multiprecision::number is wrapped in boost::optional and
a copy constructor of boost::optional is invoked.

This commit fixes the problem by destinguishing copy/move constructors of
optional_base from initializing constructors with an additional tag argument.
2018-11-04 17:35:10 +03:00
eea107d9b5 Merge branch 'develop' 2018-10-29 22:24:28 +01:00
69e239530e docs: updated releasenotes 2018-10-29 22:06:47 +01:00
65bb040db8 tests: added two test cases from GitHub issues 2018-10-29 21:47:09 +01:00
fae2791f45 added test for swapping const opitonals 2018-10-25 00:37:13 +02:00
0f8e356bca rebuilt docs 2018-10-23 22:46:26 +02:00
59277bc31f Merge branch 'Kojoley-remove-deprecation-mark-from-reset' into develop 2018-10-23 22:35:55 +02:00
bebc606a4c Remove deprecation mark from reset()
The `std::optional` has `reset()` [optional.mod] and it is not deprecated.
2018-10-23 22:34:10 +02:00
106f9aee5e Merge pull request #60 from Kojoley/workaround-gcc-8-9-regression
Workaround GCC 8-9 regression
2018-10-15 16:36:17 +02:00
350ebab88a Workaround GCC 8-9 regression
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87531
2018-10-05 18:47:16 +03:00
a3916b46a9 Merge pull request #58 from boostorg/pr/remove-mpl
Remove dependency on MPL
2018-09-12 22:39:53 +02:00
155ad5911e Merge branch 'develop' 2018-07-16 20:41:11 +02:00
2854383cf7 Merge branch 'develop' 2018-07-03 23:06:28 +02:00
8f992acb94 Merge branch 'develop' 2018-03-01 01:53:37 +01:00
18 changed files with 217 additions and 52 deletions

View File

@ -196,11 +196,10 @@ They are empty, trivially copyable classes with disabled default constructor.
bool operator!() const noexcept ; ``[link reference_optional_operator_not __GO_TO__]``
// deprecated methods
// (deprecated)
void reset() noexcept ; ``[link reference_optional_reset __GO_TO__]``
// deprecated methods
// (deprecated)
void reset ( T const& ) ; ``[link reference_optional_reset_value __GO_TO__]``
@ -275,11 +274,10 @@ They are empty, trivially copyable classes with disabled default constructor.
bool operator!() const noexcept ; ``[link reference_optional_ref_operator_not __GO_TO__]``
// deprecated methods
// (deprecated)
void reset() noexcept ; ``[link reference_optional_ref_reset __GO_TO__]``
// deprecated methods
// (deprecated)
template<class R> void reset ( R && r ) noexcept ; ``[link reference_optional_ref_reset_value __GO_TO__]``

View File

@ -541,7 +541,7 @@ __SPACE__
[#reference_optional_reset]
[: `void optional<T>::reset() noexcept ;`]
* [*Deprecated:] Same as `operator=( none_t );`
* [*Effects:] Same as `operator=( none_t );`
__SPACE__
@ -1129,8 +1129,7 @@ __SPACE__
[#reference_optional_ref_reset]
[: `void optional<T&>::reset() noexcept;`]
* [*Effects:] Use `*this = none` instead.
* [*Remarks:] This function is depprecated.
* [*Effects:] Same as `*this = none`.
__SPACE__

View File

@ -1,7 +1,7 @@
[/
Boost.Optional
Copyright (c) 2015, 2016 Andrzej Krzemienski
Copyright (c) 2015 - 2018 Andrzej Krzemienski
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
@ -11,6 +11,12 @@
[section:relnotes Release Notes]
[heading Boost Release 1.69]
* Remove deprecation mark from `reset()` method (without arguments).
* Fixed [@https://github.com/boostorg/optional/issues/59 issue #59].
* Fixed bug with initialization of certain wrapper types in clang with -std=c++03. See [@https://github.com/boostorg/optional/pull/64 pr #64].
[heading Boost Release 1.68]
* Added member function `has_value()` for compatibility with `std::optional` ([@https://github.com/boostorg/optional/issues/52 issue #52]).

View File

@ -486,14 +486,9 @@
<a name="reference_optional_ref_reset"></a><div class="blockquote"><blockquote class="blockquote"><p>
<code class="computeroutput"><span class="keyword">void</span> <span class="identifier">optional</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">&amp;&gt;::</span><span class="identifier">reset</span><span class="special">()</span> <span class="keyword">noexcept</span><span class="special">;</span></code>
</p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<span class="bold"><strong>Effects:</strong></span> Use <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span> <span class="special">=</span> <span class="identifier">none</span></code> instead.
</li>
<li class="listitem">
<span class="bold"><strong>Remarks:</strong></span> This function is depprecated.
</li>
</ul></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<span class="bold"><strong>Effects:</strong></span> Same as <code class="computeroutput"><span class="special">*</span><span class="keyword">this</span> <span class="special">=</span> <span class="identifier">none</span></code>.
</li></ul></div>
<p>
<span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>
</p>

View File

@ -1199,8 +1199,8 @@
<span class="special">;</span></code>
</p></blockquote></div>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
<span class="bold"><strong>Deprecated:</strong></span> Same as <code class="computeroutput"><span class="keyword">operator</span><span class="special">=(</span>
<span class="identifier">none_t</span> <span class="special">);</span></code>
<span class="bold"><strong>Effects:</strong></span> Same as <code class="computeroutput"><span class="keyword">operator</span><span class="special">=(</span> <span class="identifier">none_t</span>
<span class="special">);</span></code>
</li></ul></div>
<p>
<span class="inlinemediaobject"><img src="../../../images/space.png" alt="space"></span>

View File

@ -84,11 +84,10 @@
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">!()</span> <span class="keyword">const</span> <span class="keyword">noexcept</span> <span class="special">;</span> <a class="link" href="detailed_semantics___optional_references.html#reference_optional_ref_operator_not"><span class="inlinemediaobject"><img src="../../../images/callouts/R.png" alt="R"></span></a>
<span class="comment">// deprecated methods</span>
<span class="comment">// (deprecated)</span>
<span class="keyword">void</span> <span class="identifier">reset</span><span class="special">()</span> <span class="keyword">noexcept</span> <span class="special">;</span> <a class="link" href="detailed_semantics___optional_references.html#reference_optional_ref_reset"><span class="inlinemediaobject"><img src="../../../images/callouts/R.png" alt="R"></span></a>
<span class="comment">// deprecated methods</span>
<span class="comment">// (deprecated)</span>
<span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">&gt;</span> <span class="keyword">void</span> <span class="identifier">reset</span> <span class="special">(</span> <span class="identifier">R</span> <span class="special">&amp;&amp;</span> <span class="identifier">r</span> <span class="special">)</span> <span class="keyword">noexcept</span> <span class="special">;</span> <a class="link" href="detailed_semantics___optional_references.html#reference_optional_ref_reset_value"><span class="inlinemediaobject"><img src="../../../images/callouts/R.png" alt="R"></span></a>

View File

@ -122,11 +122,10 @@
<span class="keyword">bool</span> <span class="keyword">operator</span><span class="special">!()</span> <span class="keyword">const</span> <span class="keyword">noexcept</span> <span class="special">;</span> <a class="link" href="detailed_semantics___optional_values.html#reference_optional_operator_not"><span class="inlinemediaobject"><img src="../../../images/callouts/R.png" alt="R"></span></a>
<span class="comment">// deprecated methods</span>
<span class="comment">// (deprecated)</span>
<span class="keyword">void</span> <span class="identifier">reset</span><span class="special">()</span> <span class="keyword">noexcept</span> <span class="special">;</span> <a class="link" href="detailed_semantics___optional_values.html#reference_optional_reset"><span class="inlinemediaobject"><img src="../../../images/callouts/R.png" alt="R"></span></a>
<span class="comment">// deprecated methods</span>
<span class="comment">// (deprecated)</span>
<span class="keyword">void</span> <span class="identifier">reset</span> <span class="special">(</span> <span class="identifier">T</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="special">)</span> <span class="special">;</span> <a class="link" href="detailed_semantics___optional_values.html#reference_optional_reset_value"><span class="inlinemediaobject"><img src="../../../images/callouts/R.png" alt="R"></span></a>

View File

@ -28,6 +28,24 @@
</h2></div></div></div>
<h4>
<a name="boost_optional.relnotes.h0"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_69"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_69">Boost
Release 1.69</a>
</h4>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
Remove deprecation mark from <code class="computeroutput"><span class="identifier">reset</span><span class="special">()</span></code> method (without arguments).
</li>
<li class="listitem">
Fixed <a href="https://github.com/boostorg/optional/issues/59" target="_top">issue
#59</a>.
</li>
<li class="listitem">
Fixed bug with initialization of certain wrapper types in clang with -std=c++03.
See <a href="https://github.com/boostorg/optional/pull/64" target="_top">pr #64</a>.
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h1"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_68"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_68">Boost
Release 1.68</a>
</h4>
@ -44,7 +62,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h1"></a>
<a name="boost_optional.relnotes.h2"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_67"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_67">Boost
Release 1.67</a>
</h4>
@ -58,7 +76,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h2"></a>
<a name="boost_optional.relnotes.h3"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_66"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_66">Boost
Release 1.66</a>
</h4>
@ -76,7 +94,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h3"></a>
<a name="boost_optional.relnotes.h4"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_63"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_63">Boost
Release 1.63</a>
</h4>
@ -100,7 +118,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h4"></a>
<a name="boost_optional.relnotes.h5"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_62"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_62">Boost
Release 1.62</a>
</h4>
@ -108,7 +126,7 @@
Fixed <a href="https://svn.boost.org/trac/boost/ticket/12179" target="_top">Trac #12179</a>.
</li></ul></div>
<h4>
<a name="boost_optional.relnotes.h5"></a>
<a name="boost_optional.relnotes.h6"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_61"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_61">Boost
Release 1.61</a>
</h4>
@ -151,7 +169,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h6"></a>
<a name="boost_optional.relnotes.h7"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_60"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_60">Boost
Release 1.60</a>
</h4>
@ -162,7 +180,7 @@
#11203</a>.
</li></ul></div>
<h4>
<a name="boost_optional.relnotes.h7"></a>
<a name="boost_optional.relnotes.h8"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_59"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_59">Boost
Release 1.59</a>
</h4>
@ -176,7 +194,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h8"></a>
<a name="boost_optional.relnotes.h9"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_58"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_58">Boost
Release 1.58</a>
</h4>
@ -212,7 +230,7 @@
</li>
</ul></div>
<h4>
<a name="boost_optional.relnotes.h9"></a>
<a name="boost_optional.relnotes.h10"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_57"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_57">Boost
Release 1.57</a>
</h4>
@ -222,7 +240,7 @@
to fix C++03 compile error on <code class="computeroutput"><span class="identifier">logic_error</span><span class="special">(</span><span class="string">"..."</span><span class="special">)</span></code>"</em></span>.
</li></ul></div>
<h4>
<a name="boost_optional.relnotes.h10"></a>
<a name="boost_optional.relnotes.h11"></a>
<span class="phrase"><a name="boost_optional.relnotes.boost_release_1_56"></a></span><a class="link" href="relnotes.html#boost_optional.relnotes.boost_release_1_56">Boost
Release 1.56</a>
</h4>

View File

@ -145,7 +145,7 @@
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"><p><small>Last revised: July 02, 2018 at 21:10:01 GMT</small></p></td>
<td align="left"><p><small>Last revised: November 08, 2018 at 17:44:53 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>

View File

@ -332,7 +332,7 @@ class optional_base : public optional_tag
public :
// **DEPPRECATED** Destroys the current value, if any, leaving this UNINITIALIZED
// Destroys the current value, if any, leaving this UNINITIALIZED
// No-throw (assuming T::~T() doesn't)
void reset() BOOST_NOEXCEPT { destroy(); }

View File

@ -30,7 +30,7 @@ class tc_optional_base : public optional_tag
:
m_initialized(false) {}
tc_optional_base ( argument_type val )
tc_optional_base ( init_value_tag, argument_type val )
:
m_initialized(true), m_storage(val) {}
@ -71,7 +71,7 @@ class tc_optional_base : public optional_tag
// Assigns from another optional<T> (deep-copies the rhs value)
void assign ( tc_optional_base const& rhs )
{
this->operator=(rhs);
*this = rhs;
}
// Assigns from another _convertible_ optional<U> (deep-copies the rhs value)
@ -127,7 +127,7 @@ class tc_optional_base : public optional_tag
public :
// **DEPPRECATED** Destroys the current value, if any, leaving this UNINITIALIZED
// Destroys the current value, if any, leaving this UNINITIALIZED
// No-throw (assuming T::~T() doesn't)
void reset() BOOST_NOEXCEPT { destroy(); }

View File

@ -107,7 +107,9 @@ using optional_ns::in_place_init_if;
namespace optional_detail {
struct optional_tag {} ;
struct init_value_tag {};
struct optional_tag {};
template<class T>
@ -147,7 +149,7 @@ class optional_base : public optional_tag
// Creates an optional<T> initialized with 'val'.
// Can throw if T::T(T const&) does
optional_base ( argument_type val )
optional_base ( init_value_tag, argument_type val )
:
m_initialized(false)
{
@ -157,7 +159,7 @@ class optional_base : public optional_tag
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// move-construct an optional<T> initialized from an rvalue-ref to 'val'.
// Can throw if T::T(T&&) does
optional_base ( rval_reference_type val )
optional_base ( init_value_tag, rval_reference_type val )
:
m_initialized(false)
{
@ -378,7 +380,7 @@ class optional_base : public optional_tag
public :
// **DEPPRECATED** Destroys the current value, if any, leaving this UNINITIALIZED
// Destroys the current value, if any, leaving this UNINITIALIZED
// No-throw (assuming T::~T() doesn't)
void reset() BOOST_NOEXCEPT { destroy(); }
@ -870,12 +872,12 @@ class optional
// Creates an optional<T> initialized with 'val'.
// Can throw if T::T(T const&) does
optional ( argument_type val ) : base(val) {}
optional ( argument_type val ) : base(optional_detail::init_value_tag(), val) {}
#ifndef BOOST_OPTIONAL_DETAIL_NO_RVALUE_REFERENCES
// Creates an optional<T> initialized with 'move(val)'.
// Can throw if T::T(T &&) does
optional ( rval_reference_type val ) : base( boost::forward<T>(val) )
optional ( rval_reference_type val ) : base(optional_detail::init_value_tag(), boost::forward<T>(val))
{}
#endif

View File

@ -18,6 +18,7 @@ import testing ;
{
test-suite optional :
[ run optional_test.cpp ]
[ run optional_test_assign.cpp ]
[ run optional_test_swap.cpp ]
[ run optional_test_conversions_from_U.cpp ]
[ run optional_test_convert_from_T.cpp ]
@ -49,6 +50,7 @@ import testing ;
[ run optional_test_member_T.cpp ]
[ run optional_test_tc_base.cpp ]
[ compile optional_test_sfinae_friendly_ctor.cpp ]
[ compile-fail optional_test_fail_const_swap.cpp ]
[ compile-fail optional_test_ref_convert_assign_const_int_prevented.cpp ]
[ compile-fail optional_test_fail1.cpp ]
[ compile-fail optional_test_fail3a.cpp ]
@ -74,6 +76,7 @@ import testing ;
[ run optional_test_static_properties.cpp ]
[ compile optional_test_maybe_uninitialized_warning.cpp ]
[ compile optional_test_deleted_default_ctor.cpp ]
[ compile optional_test_constructible_from_other.cpp ]
#[ run optional_xconfig_HACK_TO_LIST_PREDEFINED_MACROS.cpp ]
[ run optional_xconfig_NO_PROPER_ASSIGN_FROM_CONST_INT_pass.cpp ]
[ run-fail optional_xconfig_NO_PROPER_ASSIGN_FROM_CONST_INT_fail.cpp ]

View File

@ -0,0 +1,30 @@
// Copyright (C) 2018 Andrzej Krzemienski.
//
// 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.
//
// You are welcome to contact the author at:
// akrzemi1@gmail.com
#include "boost/core/lightweight_test.hpp"
#include "boost/optional/optional.hpp"
void test_assignment_to_empty()
{
// this test used to fail on GCC 8.1.0/8.2.0/9.0.0 with -std=c++98
boost::optional<int> oa, ob(1);
BOOST_TEST(!oa);
BOOST_TEST(ob);
oa = ob;
BOOST_TEST(oa);
}
int main()
{
test_assignment_to_empty();
return boost::report_errors();
}

View File

@ -0,0 +1,57 @@
// Copyright (c) 2018 Andrey Semashev
//
// 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)
// The test verifies that Boost.Optional copy constructors do not attempt to invoke
// the element type initializing constructors from templated arguments
#include <boost/optional/optional.hpp>
#include <boost/core/enable_if.hpp>
struct no_type
{
char data;
};
struct yes_type
{
char data[2];
};
template< unsigned int Size >
struct size_tag {};
template< typename T, typename U >
struct is_constructible
{
template< typename T1, typename U1 >
static yes_type check_helper(size_tag< sizeof(static_cast< T1 >(U1())) >*);
template< typename T1, typename U1 >
static no_type check_helper(...);
static const bool value = sizeof(check_helper< T, U >(0)) == sizeof(yes_type);
};
template< typename T >
class wrapper
{
public:
wrapper() {}
wrapper(wrapper const&) {}
template< typename U >
wrapper(U const&, typename boost::enable_if_c< is_constructible< T, U >::value, int >::type = 0) {}
};
inline boost::optional< wrapper< int > > foo()
{
return boost::optional< wrapper< int > >();
}
int main()
{
// Invokes boost::optional copy constructor. Should not invoke wrapper constructor from U.
boost::optional< wrapper< int > > res = foo();
return 0;
}

View File

@ -1,4 +1,6 @@
// Copyright 2017 Peter Dimov
// Copyright 2017 Vinnie NotDefaultConstructible
// Copyright 2018 Andrzej Krzemienski
//
// Distributed under the Boost Software License, Version 1.0.
//
@ -19,8 +21,8 @@ int main()
class basic_multi_buffer;
class const_buffers_type
{
class const_buffers_type // a similar declaration in boost.beast had problem
{ // with boost opitonal
basic_multi_buffer const* b_;
friend class basic_multi_buffer;
@ -29,16 +31,36 @@ class const_buffers_type
const_buffers_type(basic_multi_buffer const& b);
public:
const_buffers_type() = delete;
const_buffers_type(const_buffers_type const&) = default;
const_buffers_type& operator=(const_buffers_type const&) = default;
};
void test_beast_example()
{
// test if it even compiles
boost::optional< std::pair<const_buffers_type, int> > opt, opt2;
opt = opt2;
(void)opt;
}
struct NotDefaultConstructible // minimal class exposing the problem
{
NotDefaultConstructible() = delete;
};
void test_assign_for_non_default_constructible()
{
// test if it even compiles
boost::optional<NotDefaultConstructible> opt, opt2;
opt = opt2;
(void)opt;
}
int main()
{
boost::optional< std::pair<const_buffers_type, int> > opt, opt2;
opt = opt2;
test_beast_example();
test_assign_for_non_default_constructible();
}
#endif

View File

@ -0,0 +1,26 @@
// Copyright (C) 2018, Andrzej Krzemienski.
//
// 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.
//
// You are welcome to contact the author at:
// akrzemi1@gmail.com
#include "boost/optional.hpp"
// THIS TEST SHOULD FAIL TO COMPILE
void test_converitng_assignment_of_different_enums()
{
const boost::optional<int> o1(1);
const boost::optional<int> o2(2);
swap(o1, o2); // no swap on const objects should compile
}
int main()
{
test_converitng_assignment_of_different_enums();
}

View File

@ -58,10 +58,20 @@ struct W
void test_value_init()
{
#ifndef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
{
S s;
W<S> w{s};
}
#endif
{
S s;
W<S> w(s);
}
}
void test_optoinal_reference_wrapper()
{
boost::optional<W<S&> > o;
BOOST_TEST(boost::none == o);
}
@ -70,6 +80,7 @@ int main()
{
test_tc_base();
test_value_init();
test_optoinal_reference_wrapper();
return boost::report_errors();
}