Skip to content

Commit 4f1ff49

Browse files
committed
Fix for lacking SFINAE support on older GCC
1 parent 9e0b9b4 commit 4f1ff49

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

tests/utilities.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <catch.hpp>
22
#include <zmq.hpp>
33

4-
#ifdef ZMQ_CPP11
4+
#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL)
55

66
namespace test_ns
77
{
@@ -16,11 +16,11 @@ struct T_mr
1616
struct T_fr
1717
{
1818
};
19-
void *begin(const T_fr &) noexcept
19+
inline void *begin(const T_fr &) noexcept
2020
{
2121
return nullptr;
2222
}
23-
void *end(const T_fr &) noexcept
23+
inline void *end(const T_fr &) noexcept
2424
{
2525
return nullptr;
2626
}
@@ -29,11 +29,11 @@ struct T_mfr
2929
void *begin() const noexcept { return nullptr; }
3030
void *end() const noexcept { return nullptr; }
3131
};
32-
void *begin(const T_mfr &) noexcept
32+
inline void *begin(const T_mfr &) noexcept
3333
{
3434
return nullptr;
3535
}
36-
void *end(const T_mfr &) noexcept
36+
inline void *end(const T_mfr &) noexcept
3737
{
3838
return nullptr;
3939
}
@@ -50,11 +50,11 @@ struct T_assoc_ns_mr : std::exception
5050
struct T_assoc_ns_fr : std::exception
5151
{
5252
};
53-
void *begin(const T_assoc_ns_fr &) noexcept
53+
inline void *begin(const T_assoc_ns_fr &) noexcept
5454
{
5555
return nullptr;
5656
}
57-
void *end(const T_assoc_ns_fr &) noexcept
57+
inline void *end(const T_assoc_ns_fr &) noexcept
5858
{
5959
return nullptr;
6060
}
@@ -63,11 +63,11 @@ struct T_assoc_ns_mfr : std::exception
6363
void *begin() const noexcept { return nullptr; }
6464
void *end() const noexcept { return nullptr; }
6565
};
66-
void *begin(const T_assoc_ns_mfr &) noexcept
66+
inline void *begin(const T_assoc_ns_mfr &) noexcept
6767
{
6868
return nullptr;
6969
}
70-
void *end(const T_assoc_ns_mfr &) noexcept
70+
inline void *end(const T_assoc_ns_mfr &) noexcept
7171
{
7272
return nullptr;
7373
}

zmq.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,12 @@
122122
#define ZMQ_DELETED_FUNCTION
123123
#endif
124124

125+
#if defined(ZMQ_CPP11) && defined(__GNUC__) && __GNUC__ < 5
126+
#define ZMQ_CPP11_PARTIAL
127+
#endif
128+
125129
#ifdef ZMQ_CPP11
126-
#if defined(__GNUC__) && __GNUC__ < 5
130+
#ifdef ZMQ_CPP11_PARTIAL
127131
#define ZMQ_IS_TRIVIALLY_COPYABLE(T) __has_trivial_copy(T)
128132
#else
129133
#define ZMQ_IS_TRIVIALLY_COPYABLE(T) std::is_trivially_copyable<T>::value
@@ -335,7 +339,7 @@ class message_t
335339
throw error_t();
336340
}
337341

338-
#ifdef ZMQ_CPP11
342+
#if defined(ZMQ_CPP11) && !defined(ZMQ_CPP11_PARTIAL)
339343
template<class Range,
340344
typename = typename std::enable_if<
341345
detail::is_range<Range>::value

0 commit comments

Comments
 (0)