Fix for lacking SFINAE support on older GCC

This commit is contained in:
Gudmundur Adalsteinsson 2019-08-30 23:14:16 +00:00
parent 9e0b9b4a38
commit 4f1ff4952d
2 changed files with 15 additions and 11 deletions

View File

@ -1,7 +1,7 @@
#include <catch.hpp>
#include <zmq.hpp>
#ifdef ZMQ_CPP11
#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL)
namespace test_ns
{
@ -16,11 +16,11 @@ struct T_mr
struct T_fr
{
};
void *begin(const T_fr &) noexcept
inline void *begin(const T_fr &) noexcept
{
return nullptr;
}
void *end(const T_fr &) noexcept
inline void *end(const T_fr &) noexcept
{
return nullptr;
}
@ -29,11 +29,11 @@ struct T_mfr
void *begin() const noexcept { return nullptr; }
void *end() const noexcept { return nullptr; }
};
void *begin(const T_mfr &) noexcept
inline void *begin(const T_mfr &) noexcept
{
return nullptr;
}
void *end(const T_mfr &) noexcept
inline void *end(const T_mfr &) noexcept
{
return nullptr;
}
@ -50,11 +50,11 @@ struct T_assoc_ns_mr : std::exception
struct T_assoc_ns_fr : std::exception
{
};
void *begin(const T_assoc_ns_fr &) noexcept
inline void *begin(const T_assoc_ns_fr &) noexcept
{
return nullptr;
}
void *end(const T_assoc_ns_fr &) noexcept
inline void *end(const T_assoc_ns_fr &) noexcept
{
return nullptr;
}
@ -63,11 +63,11 @@ struct T_assoc_ns_mfr : std::exception
void *begin() const noexcept { return nullptr; }
void *end() const noexcept { return nullptr; }
};
void *begin(const T_assoc_ns_mfr &) noexcept
inline void *begin(const T_assoc_ns_mfr &) noexcept
{
return nullptr;
}
void *end(const T_assoc_ns_mfr &) noexcept
inline void *end(const T_assoc_ns_mfr &) noexcept
{
return nullptr;
}

View File

@ -122,8 +122,12 @@
#define ZMQ_DELETED_FUNCTION
#endif
#if defined(ZMQ_CPP11) && defined(__GNUC__) && __GNUC__ < 5
#define ZMQ_CPP11_PARTIAL
#endif
#ifdef ZMQ_CPP11
#if defined(__GNUC__) && __GNUC__ < 5
#ifdef ZMQ_CPP11_PARTIAL
#define ZMQ_IS_TRIVIALLY_COPYABLE(T) __has_trivial_copy(T)
#else
#define ZMQ_IS_TRIVIALLY_COPYABLE(T) std::is_trivially_copyable<T>::value
@ -335,7 +339,7 @@ class message_t
throw error_t();
}
#ifdef ZMQ_CPP11
#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL)
template<class Range,
typename = typename std::enable_if<
detail::is_range<Range>::value