// Copyright 2019 Peter Dimov // // Distributed under 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 #if defined(_MSC_VER) # pragma warning( disable: 4702 ) // unreachable code #endif #include #include #include using namespace boost::variant2; struct Y1 { Y1() noexcept {} // =default fails on msvc-14.0 Y1(Y1&&) { throw std::runtime_error( "Y1(Y1&&)" ); } Y1& operator=(Y1&&) = default; }; struct Y2 { Y2() noexcept {} Y2(Y2&&) { throw std::runtime_error( "Y2(Y2&&)" ); } Y2& operator=(Y2&&) = default; }; void test() { variant v1( in_place_type_t{} ); variant v2( in_place_type_t{} ); BOOST_TEST_THROWS( v1 = std::move( v2 ), std::runtime_error ) } int main() { test(); return boost::report_errors(); }