1
0
forked from boostorg/mp11

g++6 doesn't like mp_any either

This commit is contained in:
Peter Dimov
2017-05-31 07:22:31 +03:00
parent 9a69b1213c
commit a768587c7d
2 changed files with 13 additions and 3 deletions

View File

@@ -132,7 +132,7 @@ template<class T1, class... T> struct mp_or_impl<T1, T...>
} // namespace detail } // namespace detail
// mp_any<T...> // mp_any<T...>
#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) #if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) && !BOOST_WORKAROUND( BOOST_GCC, < 70000 )
template<class... T> using mp_any = mp_bool<(static_cast<bool>(T::value) || ...)>; template<class... T> using mp_any = mp_bool<(static_cast<bool>(T::value) || ...)>;

View File

@@ -13,8 +13,14 @@
#include <type_traits> #include <type_traits>
using boost::mp11::mp_any; using boost::mp11::mp_any;
using boost::mp11::mp_all;
template<class... T> using check = mp_any<std::is_nothrow_copy_constructible<T>..., mp_any<std::is_nothrow_move_constructible<T>...>>; template<class... T> using check1 = mp_any<std::is_nothrow_copy_constructible<T>..., mp_any<std::is_nothrow_move_constructible<T>...>>;
template<class... T> using check2 = mp_any<mp_any<std::is_nothrow_copy_constructible<T>...>, std::is_nothrow_move_constructible<T>...>;
template<class... T> using check3 = mp_any<mp_all<std::is_nothrow_copy_constructible<T>...>, std::is_nothrow_default_constructible<T>...>;
template<bool is_trivially_destructible, bool is_single_buffered, class... T> struct variant_base_impl {};
template<class... T> using variant_base = variant_base_impl<mp_all<std::is_trivially_destructible<T>...>::value, mp_any<mp_all<std::is_nothrow_move_constructible<T>...>, std::is_nothrow_default_constructible<T>...>::value, T...>;
int main() int main()
{ {
@@ -61,7 +67,11 @@ int main()
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any<mp_size_t<0>, mp_int<0>, mp_false, mp_size_t<141>>, mp_true>)); BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any<mp_size_t<0>, mp_int<0>, mp_false, mp_size_t<141>>, mp_true>));
BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any<mp_size_t<0>, mp_int<0>, mp_false>, mp_false>)); BOOST_TEST_TRAIT_TRUE((std::is_same<mp_any<mp_size_t<0>, mp_int<0>, mp_false>, mp_false>));
BOOST_TEST_TRAIT_TRUE((std::is_same<check<void, int, float>, mp_true>)); BOOST_TEST_TRAIT_TRUE((std::is_same<check1<void, int, float>, mp_true>));
BOOST_TEST_TRAIT_TRUE((std::is_same<check2<void, int, float>, mp_true>));
BOOST_TEST_TRAIT_TRUE((std::is_same<check3<void, int, float>, mp_true>));
variant_base<void, int, float>();
return boost::report_errors(); return boost::report_errors();
} }