MessageSvcSink fails to compile with nlohman_json 3.10.5
@mato reported that with nlohman_json 3.10.5 we get the error
In file included from /build/lcgsoft/build/frameworks/Gaudi-v36r3/src/Gaudi/v36r3/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp:18:
/build/lcgsoft/install/dev4/fmt/7.1.3/x86_64-centos7-gcc8-opt/include/fmt/core.h: In instantiation of ‘fmt::v7::detail::value<Context> fmt::v7::detail::make_arg(const T&) [with bool IS_PACKED = true; Context = fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<char>, char>; fmt::v7::detail::type <anonymous> = (fmt::v7::detail::type)15; T = nlohmann::basic_json<>; typename std::enable_if<IS_PACKED, int>::type <anonymous> = 0]’:
/build/lcgsoft/install/dev4/fmt/7.1.3/x86_64-centos7-gcc8-opt/include/fmt/core.h:1589:64: required from ‘fmt::v7::format_arg_store<Context, Args>::format_arg_store(const Args& ...) [with Context = fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<char>, char>; Args = {char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, const nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >}]’
/build/lcgsoft/install/dev4/fmt/7.1.3/x86_64-centos7-gcc8-opt/include/fmt/core.h:1626:18: required from ‘fmt::v7::format_arg_store<fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<Char>, Char>, fmt::v7::remove_reference_t<Args>...> fmt::v7::make_args_checked(const S&, fmt::v7::remove_reference_t<Args>& ...) [with Args = {char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, const nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >&}; S = char [15]; Char = char]’
/build/lcgsoft/install/dev4/fmt/7.1.3/x86_64-centos7-gcc8-opt/include/fmt/core.h:2075:54: required from ‘std::__cxx11::basic_string<Char> fmt::v7::format(const S&, Args&& ...) [with S = char [15]; Args = {char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, const nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >&}; Char = char]’
/build/lcgsoft/build/frameworks/Gaudi-v36r3/src/Gaudi/v36r3/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp:140:30: required from ‘stream {anonymous}::printCounter(stream&, const string&, const json&) [with stream = MsgStream; std::__cxx11::string = std::__cxx11::basic_string<char>; nlohmann::json = nlohmann::basic_json<>]’
/build/lcgsoft/build/frameworks/Gaudi-v36r3/src/Gaudi/v36r3/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp:211:21: required from ‘Gaudi::Monitoring::MessageSvcSink::stop()::<lambda(auto:10&)> [with auto:10 = std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> >]’
/cvmfs/sft.cern.ch/lcg/releases/gcc/8.3.0-cebb0/x86_64-centos7/include/c++/8.3.0/bits/stl_algo.h:3882:5: required from ‘_Funct std::for_each(_IIter, _IIter, _Funct) [with _IIter = std::_Rb_tree_iterator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::basic_json<> > >; _Funct = Gaudi::Monitoring::MessageSvcSink::stop()::<lambda(auto:10&)>]’
/build/lcgsoft/build/frameworks/Gaudi-v36r3/src/Gaudi/v36r3/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp:213:7: required from here
/build/lcgsoft/install/dev4/fmt/7.1.3/x86_64-centos7-gcc8-opt/include/fmt/core.h:1438:49: error: conversion from ‘const nlohmann::basic_json<>’ to ‘fmt::v7::detail::value<fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<char>, char> >’ is ambiguous
return check<T>(arg_mapper<Context>().map(val));
^
In file included from /build/lcgsoft/build/frameworks/Gaudi-v36r3/src/Gaudi/v36r3/GaudiKernel/include/Gaudi/MonitoringHub.h:17,
from /build/lcgsoft/build/frameworks/Gaudi-v36r3/src/Gaudi/v36r3/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp:12:
/build/lcgsoft/install/dev4/jsonmcpp/3.10.5/x86_64-centos7-gcc8-opt/include/nlohmann/json.hpp:1885:55: note: candidate: ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::operator ValueType() const [with ValueType = fmt::v7::detail::value<fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<char>, char> >; typename std::enable_if<nlohmann::detail::conjunction<nlohmann::detail::negation<std::is_pointer<_Ptr> >, nlohmann::detail::negation<std::is_same<ValueType, nlohmann::detail::json_ref<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType> > > >, nlohmann::detail::negation<std::is_same<ValueType, typename StringType::value_type> >, nlohmann::detail::negation<nlohmann::detail::is_basic_json<BasicJsonType> >, nlohmann::detail::negation<std::is_same<ValueType, std::initializer_list<typename StringType::value_type> > >, nlohmann::detail::negation<std::is_same<ValueType, std::basic_string_view<char, std::char_traits<char> > > >, nlohmann::detail::is_detected_lazy<nlohmann::detail::get_template_function, const nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>&, ValueType> >::value, int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>]’
JSON_EXPLICIT operator ValueType() const
^~~~~~~~
In file included from /build/lcgsoft/build/frameworks/Gaudi-v36r3/src/Gaudi/v36r3/GaudiCoreSvc/src/MessageSvc/MessageSvcSink.cpp:18:
/build/lcgsoft/install/dev4/fmt/7.1.3/x86_64-centos7-gcc8-opt/include/fmt/core.h:1091:36: note: candidate: ‘fmt::v7::detail::value<Context>::value(const T&) [with T = nlohmann::basic_json<>; Context = fmt::v7::basic_format_context<fmt::v7::detail::buffer_appender<char>, char>]’
template <typename T> FMT_INLINE value(const T& val) {
^~~~~
make[5]: *** [GaudiCoreSvc/CMakeFiles/GaudiCoreSvc.dir/src/MessageSvc/MessageSvcSink.cpp.o] Error 1
make[4]: *** [GaudiCoreSvc/CMakeFiles/GaudiCoreSvc.dir/all] Error 2
and I confirmed it with a local test.