From 82a1cb6f36a6afc8397e46537e6b8104b3a6b197 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Mon, 27 Nov 2023 02:05:19 +0200 Subject: [PATCH] Work around msvc-12.0 failures in mp_sliding_fold tests --- test/mp_sliding_fold.cpp | 21 +++++++++++++++++---- test/mp_sliding_fold_q.cpp | 23 ++++++++++++++++++++--- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/test/mp_sliding_fold.cpp b/test/mp_sliding_fold.cpp index 5eacc35..ba6ee2b 100644 --- a/test/mp_sliding_fold.cpp +++ b/test/mp_sliding_fold.cpp @@ -5,7 +5,9 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include +#include +#include +#include #include #include #include @@ -16,13 +18,24 @@ struct X3 {}; struct X4 {}; struct X5 {}; -template using average = boost::mp11::mp_int::value / sizeof...(C)>; +using boost::mp11::mp_plus; +using boost::mp11::mp_int; + +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) + +template using average = mp_int::value / sizeof...(C)>; + +#else + +template struct average_impl: mp_int::value / sizeof...(C)> {}; +template using average = typename average_impl::type; + +#endif int main() { using boost::mp11::mp_list; using boost::mp11::mp_list_c; - using boost::mp11::mp_plus; using boost::mp11::mp_size_t; using boost::mp11::mp_sliding_fold; @@ -67,7 +80,7 @@ int main() BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<6>, mp_list>, mp_list<>>)); BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<6>, mp_list>, mp_list<>>)); BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<6>, mp_list>, mp_list<>>)); - + BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<2>, std::pair>, mp_list<>>)); BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<2>, std::pair>, mp_list<>>)); BOOST_TEST_TRAIT_TRUE((std::is_same, mp_size_t<2>, std::pair>, mp_list>>)); diff --git a/test/mp_sliding_fold_q.cpp b/test/mp_sliding_fold_q.cpp index ac68f09..87794c9 100644 --- a/test/mp_sliding_fold_q.cpp +++ b/test/mp_sliding_fold_q.cpp @@ -5,7 +5,9 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include +#include +#include +#include #include #include #include @@ -16,16 +18,31 @@ struct X3 {}; struct X4 {}; struct X5 {}; +using boost::mp11::mp_plus; +using boost::mp11::mp_int; + +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) + struct average { - template using fn = boost::mp11::mp_int::value / sizeof...(C)>; + template using fn = mp_int::value / sizeof...(C)>; }; +#else + +template struct average_impl: mp_int::value / sizeof...(C)> {}; + +struct average +{ + template using fn = typename average_impl::type; +}; + +#endif + int main() { using boost::mp11::mp_list; using boost::mp11::mp_list_c; - using boost::mp11::mp_plus; using boost::mp11::mp_quote; using boost::mp11::mp_size_t; using boost::mp11::mp_sliding_fold_q;