More g++ 4.8 fixes, const&& doesn't work well

This commit is contained in:
Peter Dimov
2018-10-18 18:51:19 +03:00
parent 24d7f83403
commit d1acc969f7
2 changed files with 13 additions and 0 deletions

View File

@ -1374,6 +1374,10 @@ public:
return mp_with_index<sizeof...(T)>( index(), L10<U...>{ this } ); return mp_with_index<sizeof...(T)>( index(), L10<U...>{ this } );
} }
#if !BOOST_WORKAROUND(BOOST_GCC, < 40900)
// g++ 4.8 doesn't handle const&& particularly well
private: private:
template<class... U> struct L11 template<class... U> struct L11
@ -1395,6 +1399,8 @@ public:
{ {
return mp_with_index<sizeof...(T)>( index(), L11<U...>{ this } ); return mp_with_index<sizeof...(T)>( index(), L11<U...>{ this } );
} }
#endif
}; };
// relational operators // relational operators

View File

@ -14,6 +14,7 @@
#include <boost/mp11.hpp> #include <boost/mp11.hpp>
#include <boost/core/lightweight_test.hpp> #include <boost/core/lightweight_test.hpp>
#include <boost/core/lightweight_test_trait.hpp> #include <boost/core/lightweight_test_trait.hpp>
#include <boost/config.hpp>
#include <type_traits> #include <type_traits>
#include <utility> #include <utility>
#include <string> #include <string>
@ -112,7 +113,13 @@ int main()
BOOST_TEST_EQ( decltype(visit(F{}, v))::value, 1 ); BOOST_TEST_EQ( decltype(visit(F{}, v))::value, 1 );
BOOST_TEST_EQ( decltype(visit(F{}, cv))::value, 2 ); BOOST_TEST_EQ( decltype(visit(F{}, cv))::value, 2 );
BOOST_TEST_EQ( decltype(visit(F{}, std::move(v)))::value, 3 ); BOOST_TEST_EQ( decltype(visit(F{}, std::move(v)))::value, 3 );
#if !BOOST_WORKAROUND(BOOST_GCC, < 40900)
// g++ 4.8 doesn't handle const&& particularly well
BOOST_TEST_EQ( decltype(visit(F{}, std::move(cv)))::value, 4 ); BOOST_TEST_EQ( decltype(visit(F{}, std::move(cv)))::value, 4 );
#endif
} }
return boost::report_errors(); return boost::report_errors();