is_virtual_base_of: tentative fixes for clang and older gcc versions.

[CI SKIP]
This commit is contained in:
jzmaddock
2018-05-10 10:31:24 +01:00
parent 770c095dcc
commit 02270ed668
2 changed files with 29 additions and 10 deletions

View File

@ -11,9 +11,10 @@
#include <boost/type_traits/is_base_of.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/make_void.hpp>
namespace boost {
namespace detail {
namespace detail {
#ifdef BOOST_MSVC
@ -23,7 +24,31 @@ namespace detail {
#pragma GCC system_header
#endif
#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && !defined(BOOST_NO_CXX11_NULLPTR)
#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && !defined(BOOST_NO_CXX11_NULLPTR) && !BOOST_WORKAROUND(BOOST_GCC, <= 40800)
#ifdef __clang__
template<class T, class U>
constexpr bool is_virtual_base_impl(...) { return true; }
template<class T, class U,
boost::void_t<decltype(static_cast<U*>(std::declval<T*>()))>* =
nullptr>
constexpr bool is_virtual_base_impl(int) { return false; }
} // namespace detail
template<class T, class U>
struct is_virtual_base_of : public
boost::integral_constant<
bool,
boost::is_base_of<T, U>::value &&
detail::is_virtual_base_impl<T, U>(0) &&
!detail::is_virtual_base_impl<U, T>(0)
> {};
#else
template<class Base, class Derived>
struct is_virtual_base_of_impl
@ -63,6 +88,8 @@ struct is_virtual_base_of_impl
template <class Base, class Derived> struct is_virtual_base_of : public integral_constant<bool, (::boost::detail::is_virtual_base_of_impl<Base, Derived>::value)>{};
#endif // __clang__
#else
template<typename Base, typename Derived, typename tag>

View File

@ -145,11 +145,3 @@ BOOST_CHECK_INTEGRAL_CONSTANT((::tt::is_virtual_base_of<non_virtual_base, privat
TT_TEST_END