diff --git a/include/boost/variant2/variant.hpp b/include/boost/variant2/variant.hpp index 3cf2dc1..5515600 100644 --- a/include/boost/variant2/variant.hpp +++ b/include/boost/variant2/variant.hpp @@ -1,7 +1,7 @@ #ifndef BOOST_VARIANT2_VARIANT_HPP_INCLUDED #define BOOST_VARIANT2_VARIANT_HPP_INCLUDED -// Copyright 2017, 2018 Peter Dimov. +// Copyright 2017-2019 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // @@ -266,6 +266,10 @@ template struct variant_alternative> #endif +// variant_npos + +constexpr std::size_t variant_npos = ~static_cast( 0 ); + // holds_alternative template constexpr bool holds_alternative( variant const& v ) noexcept @@ -1350,6 +1354,11 @@ public: // value status + constexpr bool valueless_by_exception() const noexcept + { + return false; + } + using variant_base::index; // swap diff --git a/test/Jamfile b/test/Jamfile index 7ad76a4..18642a0 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -1,6 +1,6 @@ # Boost.Variant2 Library Test Jamfile # -# Copyright 2015-2017 Peter Dimov +# Copyright 2015-2019 Peter Dimov # # Distributed under the Boost Software License, Version 1.0. # See accompanying file LICENSE_1_0.txt or copy at @@ -9,7 +9,19 @@ import testing ; import ../../config/checks/config : requires ; -project : requirements [ requires cxx11_variadic_templates cxx11_template_aliases cxx11_decltype cxx11_constexpr ] ; +project + : default-build + + all + + : requirements + + [ requires cxx11_variadic_templates cxx11_template_aliases cxx11_decltype cxx11_constexpr ] + + msvc:on + gcc:on + clang:on + ; run variant_size.cpp ; run variant_alternative.cpp ; diff --git a/test/variant_convert_construct_throw.cpp b/test/variant_convert_construct_throw.cpp index 79757fc..bb53d7c 100644 --- a/test/variant_convert_construct_throw.cpp +++ b/test/variant_convert_construct_throw.cpp @@ -6,6 +6,10 @@ // 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 diff --git a/test/variant_copy_assign_throw.cpp b/test/variant_copy_assign_throw.cpp index 7f98f70..a13dccb 100644 --- a/test/variant_copy_assign_throw.cpp +++ b/test/variant_copy_assign_throw.cpp @@ -6,6 +6,10 @@ // 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 diff --git a/test/variant_copy_construct_throw.cpp b/test/variant_copy_construct_throw.cpp index 88937c2..81b44d9 100644 --- a/test/variant_copy_construct_throw.cpp +++ b/test/variant_copy_construct_throw.cpp @@ -6,6 +6,10 @@ // 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 diff --git a/test/variant_move_assign_throw.cpp b/test/variant_move_assign_throw.cpp index 6e65518..c1df594 100644 --- a/test/variant_move_assign_throw.cpp +++ b/test/variant_move_assign_throw.cpp @@ -6,6 +6,10 @@ // 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 diff --git a/test/variant_move_construct_throw.cpp b/test/variant_move_construct_throw.cpp index 01b2b02..aabf7d2 100644 --- a/test/variant_move_construct_throw.cpp +++ b/test/variant_move_construct_throw.cpp @@ -6,6 +6,10 @@ // 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 diff --git a/test/variant_subset.cpp b/test/variant_subset.cpp index 86cd505..90c9bc2 100644 --- a/test/variant_subset.cpp +++ b/test/variant_subset.cpp @@ -6,6 +6,10 @@ // 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 diff --git a/test/variant_valueless.cpp b/test/variant_valueless.cpp index 6a13086..176c674 100644 --- a/test/variant_valueless.cpp +++ b/test/variant_valueless.cpp @@ -6,6 +6,10 @@ // 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