Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85080 - in trunk: boost/variant libs/variant/test
From: antoshkka_at_[hidden]
Date: 2013-07-19 03:52:40


Author: apolukhin
Date: 2013-07-19 03:52:40 EDT (Fri, 19 Jul 2013)
New Revision: 85080
URL: http://svn.boost.org/trac/boost/changeset/85080

Log:
Fix compilation of Boost.Variants move assignment for situations when one of the variant template classes has nothrow copy constructor and throwing move constructor (refs #8772)

Text files modified:
   trunk/boost/variant/variant.hpp | 2 +-
   trunk/libs/variant/test/rvalue_test.cpp | 16 ++++++++++++++++
   2 files changed, 17 insertions(+), 1 deletions(-)

Modified: trunk/boost/variant/variant.hpp
==============================================================================
--- trunk/boost/variant/variant.hpp Fri Jul 19 03:43:03 2013 (r85079)
+++ trunk/boost/variant/variant.hpp 2013-07-19 03:52:40 EDT (Fri, 19 Jul 2013) (r85080)
@@ -1980,7 +1980,7 @@
 
     private: // helpers, for internal visitor interface (below)
 
- template <typename RhsT, typename B1, typename B2>
+ template <typename RhsT, typename B2>
         void assign_impl(
               RhsT& rhs_content
             , mpl::true_ // has_nothrow_copy

Modified: trunk/libs/variant/test/rvalue_test.cpp
==============================================================================
--- trunk/libs/variant/test/rvalue_test.cpp Fri Jul 19 03:43:03 2013 (r85079)
+++ trunk/libs/variant/test/rvalue_test.cpp 2013-07-19 03:52:40 EDT (Fri, 19 Jul 2013) (r85080)
@@ -196,6 +196,21 @@
 
 #endif
 
+struct nothrow_copyable_throw_movable {
+ nothrow_copyable_throw_movable(){}
+ nothrow_copyable_throw_movable(const nothrow_copyable_throw_movable&) BOOST_NOEXCEPT {}
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
+ nothrow_copyable_throw_movable(nothrow_copyable_throw_movable&&) BOOST_NOEXCEPT_IF(false) {}
+#endif
+};
+
+// This test is created to cover the following situation:
+// https://svn.boost.org/trac/boost/ticket/8772
+void run_tricky_compilation_test()
+{
+ boost::variant<int, nothrow_copyable_throw_movable> v;
+ v = nothrow_copyable_throw_movable();
+}
 
 int test_main(int , char* [])
 {
@@ -203,5 +218,6 @@
    run1();
    run_move_only();
    run_moves_are_noexcept();
+ run_tricky_compilation_test();
    return 0;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk