Closed jasujm closed 2 years ago
Totals | |
---|---|
Change from base Build 1266731609: | 0.0% |
Covered Lines: | 801 |
Relevant Lines: | 931 |
Looks good, thanks.
Hi @gummif , I encountered this error when trying to #include "zmq.hpp"
:
// This is the macro expansion result
using socket_type_t = integral_option<16, socket_type, false>; inline constexpr socket_type_t socket_type {}
// The error
"zmq::sockopt::socket_type" is not a type name
According to my linter, this is caused by https://github.com/zeromq/cppzmq/blob/a98fa4a91d868a3844e5456741d6782cc1a8d98b/zmq.hpp#L1652
My workaround is:
// socket_type seems to be resolved to zmq::sockopt::socket_type instead of the enum class zmq::socket_type
ZMQ_DEFINE_INTEGRAL_OPT(ZMQ_TYPE, socket_type, zmq::socket_type);
I'm not very familiar with cpp, so I'm wondering whether this should be considered as a bug introduced by the PR, or an issue caused by possible misconfiguration?
My environment: #define CPPZMQ_LANG _MSVC_LANG
which extends to 201703L
and #define _MSC_VER 1929
Solution: Add
zmq::sockopt::socket_type
that is used toget()
an enumerator fromzmq::socket_type
instead of plainint
.It makes code like this compile:
include
include
int main() { zmq::context_t ctx; zmq::socket_t sock(ctx, zmq::socket_type::push); assert(sock.get(zmq::sockopt::socket_type) == zmq::socket_type::push); return 0; }
This patch solves https://github.com/zeromq/cppzmq/issues/522