morganstanley / binlog

A high performance C++ log library, producing structured binary logs
http://opensource.morganstanley.com/binlog/
Apache License 2.0
608 stars 72 forks source link

BINLOG_ADAPT_CONCEPT does not support namespaces #154

Closed andrewkcorcoran closed 1 year ago

andrewkcorcoran commented 2 years ago
namespace  ns {

template<typename T>
concept Concept2 = requires(T t)
{
    {t.A} -> std::convertible_to<std::string_view>;
    {t.B} -> std::convertible_to<std::string_view>;
};

} // namespace  ns

BINLOG_ADAPT_CONCEPT(ns::Concept2, A, B)
../../source/utils/test/test_serialize.cpp:33:22: error: template argument for template type parameter must be a type; did you forget 'typename'?
BINLOG_ADAPT_CONCEPT(ns::Concept2, A, B)
                     ^
                     typename
_deps/binlog-src/include/binlog/adapt_struct.hpp:153:79: note: expanded from macro 'BINLOG_ADAPT_CONCEPT'
  MSERIALIZE_EXPAND(MSERIALIZE_MAKE_TEMPLATE_SERIALIZABLE((Concept Concept), (Concept) __VA_OPT__(,) __VA_ARGS__)) \
                                                                              ^
_deps/binlog-src/include/mserialize/make_template_serializable.hpp:63:59: note: expanded from macro 'MSERIALIZE_MAKE_TEMPLATE_SERIALIZABLE'
    :StructSerializer<MSERIALIZE_UNTUPLE(MSERIALIZE_FIRST(__VA_ARGS__)) \
                                                          ^
_deps/binlog-src/include/mserialize/detail/preprocessor.hpp:8:68: note: expanded from macro 'MSERIALIZE_FIRST'
#define MSERIALIZE_FIRST(...) MSERIALIZE_EXPAND(MSERIALIZE_FIRST_I(__VA_ARGS__, 0))
                                                                   ^
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
_deps/binlog-src/include/mserialize/detail/preprocessor.hpp:20:52: note: expanded from macro 'MSERIALIZE_UNTUPLE'
#define MSERIALIZE_UNTUPLE(a) MSERIALIZE_UNTUPLE_I a
                                                   ^
_deps/binlog-src/include/mserialize/detail/preprocessor.hpp:21:35: note: expanded from macro 'MSERIALIZE_UNTUPLE_I'
#define MSERIALIZE_UNTUPLE_I(...) __VA_ARGS__
                                  ^
_deps/binlog-src/include/mserialize/detail/preprocessor.hpp:5:30: note: expanded from macro 'MSERIALIZE_EXPAND'
#define MSERIALIZE_EXPAND(x) x
                             ^
_deps/binlog-src/include/mserialize/StructSerializer.hpp:88:20: note: template parameter is declared here
template <typename T, typename... Members>
andrewkcorcoran commented 1 year ago

Any updates on this, currently a blocker for us?

erenon commented 1 year ago

@andrewkcorcoran please take a look at #158 if that works for you.

andrewkcorcoran commented 1 year ago

@erenon I left a comment on the PR with some errors I'm seeing

erenon commented 1 year ago

hi, I'm aware of the issue and I can think of a possible fix, but I lack the time, sorry.