From 4f1ff4952df682c6dfe243fd4e879c9aaec06af2 Mon Sep 17 00:00:00 2001 From: Gudmundur Adalsteinsson Date: Fri, 30 Aug 2019 23:14:16 +0000 Subject: [PATCH] Fix for lacking SFINAE support on older GCC --- tests/utilities.cpp | 18 +++++++++--------- zmq.hpp | 8 ++++++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/tests/utilities.cpp b/tests/utilities.cpp index c7b8c99..9f1e2f2 100644 --- a/tests/utilities.cpp +++ b/tests/utilities.cpp @@ -1,7 +1,7 @@ #include #include -#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; } diff --git a/zmq.hpp b/zmq.hpp index 3b76a78..c86be81 100644 --- a/zmq.hpp +++ b/zmq.hpp @@ -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::value @@ -335,7 +339,7 @@ class message_t throw error_t(); } -#ifdef ZMQ_CPP11 +#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL) template::value