Skip to content

Compilation error if json_pointer is used with alternative string type #3388

Description

@FonsDC

What is the issue you have?

If basic_json is specialized with an alternative string type, like in the unit-alt-string.cpp unit test, and at or operator[] is used with a json_pointer argument, then compilation fails.

Please describe the steps to reproduce the issue.

See below

Can you provide a small but working code example?

Add this test section to unit-alt-string.cpp and build the unit tests:

    SECTION("JSON pointer")
    {
         alt_json j = R"(
         {
             "foo": ["bar", "baz"]
         }
         )"_json;

         CHECK(j.at(alt_json::json_pointer("/foo/0")) == j["foo"][0]);
         CHECK(j.at(alt_json::json_pointer("/foo/1")) == j["foo"][1]);
    }

Compilation fails, see error output below.

Which compiler and operating system are you using?

  • Compiler: gcc 8.3.1
  • Operating system: Centos 7

Which version of the library did you use?

  • latest release version 3.10.5
  • other release - please state the version: 3.9.1
  • the develop branch

If you experience a compilation error: can you compile and run the unit tests?

  • yes
  • no (if the test section show above is added!)
[ 67%] Building CXX object test/CMakeFiles/test-alt-string.dir/src/unit-alt-string.cpp.o
In file included from /home/x/test/json-3.10.5/test/src/unit-alt-string.cpp:32:
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp: In instantiation of ‘BasicJsonType& nlohmann::json_pointer<BasicJsonType>::get_checked(BasicJsonType*) const [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>]’:
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:21351:36:   required from ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_type& nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::at(const json_pointer&) [with ObjectType = std::map; ArrayType = std::vector; StringType = alt_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::reference = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>&; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_type = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::json_pointer = nlohmann::json_pointer<nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer> >]’
/home/x/test/json-3.10.5/test/src/unit-alt-string.cpp:308:10:   required from here
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:12628:27: error: no matching function for call to ‘nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>::at(const std::basic_string<char>&)’
                     ptr = &ptr->at(reference_token);
In file included from /home/x/test/json-3.10.5/test/src/unit-alt-string.cpp:32:
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:19090:15: note: candidate: ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_type& nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::at(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::size_type) [with ObjectType = std::map; ArrayType = std::vector; StringType = alt_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::reference = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>&; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_type = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::size_type = long unsigned int]’
     reference at(size_type idx)
               ^~
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:19090:15: note:   no known conversion for argument 1 from ‘const std::basic_string<char>’ to ‘nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>::size_type’ {aka ‘long unsigned int’}
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:19113:21: note: candidate: ‘const value_type& nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::at(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::size_type) const [with ObjectType = std::map; ArrayType = std::vector; StringType = alt_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::const_reference = const nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>&; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_type = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::size_type = long unsigned int]’
     const_reference at(size_type idx) const
                     ^~
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:19113:21: note:   no known conversion for argument 1 from ‘const std::basic_string<char>’ to ‘nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>::size_type’ {aka ‘long unsigned int’}
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:19136:15: note: candidate: ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_type& nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::at(const typename nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::object_t::key_type&) [with ObjectType = std::map; ArrayType = std::vector; StringType = alt_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::reference = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>&; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_type = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; typename nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::object_t::key_type = alt_string]’
     reference at(const typename object_t::key_type& key)
               ^~
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:19136:15: note:   no known conversion for argument 1 from ‘const std::basic_string<char>’ to ‘const key_type&’ {aka ‘const alt_string&’}
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:19159:21: note: candidate: ‘const value_type& nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::at(const typename nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::object_t::key_type&) const [with ObjectType = std::map; ArrayType = std::vector; StringType = alt_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::const_reference = const nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>&; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_type = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; typename nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::object_t::key_type = alt_string]’
     const_reference at(const typename object_t::key_type& key) const
                     ^~
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:19159:21: note:   no known conversion for argument 1 from ‘const std::basic_string<char>’ to ‘const key_type&’ {aka ‘const alt_string&’}
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:21349:15: note: candidate: ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_type& nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::at(const json_pointer&) [with ObjectType = std::map; ArrayType = std::vector; StringType = alt_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::reference = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>&; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_type = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::json_pointer = nlohmann::json_pointer<nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer> >]’
     reference at(const json_pointer& ptr)
               ^~
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:21349:15: note:   no known conversion for argument 1 from ‘const std::basic_string<char>’ to ‘const json_pointer&’ {aka ‘const nlohmann::json_pointer<nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer> >&’}
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:21356:21: note: candidate: ‘const value_type& nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::at(const json_pointer&) const [with ObjectType = std::map; ArrayType = std::vector; StringType = alt_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::const_reference = const nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>&; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_type = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::json_pointer = nlohmann::json_pointer<nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer> >]’
     const_reference at(const json_pointer& ptr) const
                     ^~
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:21356:21: note:   no known conversion for argument 1 from ‘const std::basic_string<char>’ to ‘const json_pointer&’ {aka ‘const nlohmann::json_pointer<nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer> >&’}
In file included from /home/x/test/json-3.10.5/test/src/unit-alt-string.cpp:32:
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp: In instantiation of ‘void nlohmann::detail::to_json(BasicJsonType&, const std::pair<_Tp1, _Tp2>&) [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; T1 = const std::basic_string<char>; T2 = nlohmann::basic_json<>; typename std::enable_if<(std::is_constructible<BasicJsonType, T1>::value && std::is_constructible<BasicJsonType, T2>::value), int>::type <anonymous> = 0]’:
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:4901:23:   required from ‘decltype ((nlohmann::detail::to_json(j, forward<T>(val)), void())) nlohmann::detail::to_json_fn::operator()(BasicJsonType&, T&&) const [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; T = const std::pair<const std::basic_string<char>, nlohmann::basic_json<> >&; decltype ((nlohmann::detail::to_json(j, forward<T>(val)), void())) = void]’
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:4954:28:   required from ‘static decltype ((nlohmann::{anonymous}::to_json(j, forward<TargetType>(val)), void())) nlohmann::adl_serializer<T, SFINAE>::to_json(BasicJsonType&, TargetType&&) [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; TargetType = const std::pair<const std::basic_string<char>, nlohmann::basic_json<> >&; ValueType = std::pair<const std::basic_string<char>, nlohmann::basic_json<> >; <template-parameter-1-2> = void; decltype ((nlohmann::{anonymous}::to_json(j, forward<TargetType>(val)), void())) = void]’
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:17997:35:   required from ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::basic_json(CompatibleType&&) [with CompatibleType = const std::pair<const std::basic_string<char>, nlohmann::basic_json<> >&; U = std::pair<const std::basic_string<char>, nlohmann::basic_json<> >; typename std::enable_if<((! nlohmann::detail::is_basic_json<U>::value) && nlohmann::detail::is_compatible_type<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>, U>::value), int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = alt_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>]’
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_construct.h:75:7:   required from ‘void std::_Construct(_T1*, _Args&& ...) [with _T1 = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; _Args = {const std::pair<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, nlohmann::basic_json<std::map, std::vector, std::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> > > >&}]’
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_uninitialized.h:83:18:   required from ‘static _ForwardIterator std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = std::_Rb_tree_const_iterator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > >; _ForwardIterator = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>*; bool _TrivialValueTypes = false]’
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_uninitialized.h:134:15:   [ skipping 8 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:4672:25:   required from ‘static void nlohmann::detail::external_constructor<(nlohmann::detail::value_t)2>::construct(BasicJsonType&, const CompatibleArrayType&) [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; CompatibleArrayType = std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<void>, std::allocator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > > >; typename std::enable_if<(! std::is_same<CompatibleArrayType, typename BasicJsonType::array_t>::value), int>::type <anonymous> = 0]’
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:4816:52:   required from ‘void nlohmann::detail::to_json(BasicJsonType&, const CompatibleArrayType&) [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; CompatibleArrayType = std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<void>, std::allocator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > > >; typename std::enable_if<((((nlohmann::detail::is_compatible_array_type<BasicJsonType, CompatibleArrayType>::value && (! nlohmann::detail::is_compatible_object_type<BasicJsonType, CompatibleObjectType>::value)) && (! nlohmann::detail::is_compatible_string_type<BasicJsonType, CompatibleStringType>::value)) && (! std::is_same<typename BasicJsonType::binary_t, CompatibleArrayType>::value)) && (! nlohmann::detail::is_basic_json<T>::value)), int>::type <anonymous> = 0]’
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:4901:23:   required from ‘decltype ((nlohmann::detail::to_json(j, forward<T>(val)), void())) nlohmann::detail::to_json_fn::operator()(BasicJsonType&, T&&) const [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; T = const std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<void>, std::allocator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > > >&; decltype ((nlohmann::detail::to_json(j, forward<T>(val)), void())) = void]’
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:4954:28:   required from ‘static decltype ((nlohmann::{anonymous}::to_json(j, forward<TargetType>(val)), void())) nlohmann::adl_serializer<T, SFINAE>::to_json(BasicJsonType&, TargetType&&) [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>; TargetType = const std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<void>, std::allocator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > > >&; ValueType = std::map<std::basic_string<char>, nlohmann::basic_json<>, std::less<void>, std::allocator<std::pair<const std::basic_string<char>, nlohmann::basic_json<> > > >; <template-parameter-1-2> = void; decltype ((nlohmann::{anonymous}::to_json(j, forward<TargetType>(val)), void())) = void]’
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:18036:56:   required from ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::basic_json(const BasicJsonType&) [with BasicJsonType = nlohmann::basic_json<>; typename std::enable_if<(nlohmann::detail::is_basic_json<BasicJsonType>::value && (! std::is_same<nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>, BasicJsonType>::value)), int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = alt_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>]’
/home/x/test/json-3.10.5/test/src/unit-alt-string.cpp:302:23:   required from here
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:4864:7: error: conversion from ‘const nlohmann::basic_json<>’ to ‘nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer> >’ is ambiguous
     j = { p.first, p.second };
     ~~^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/x/test/json-3.10.5/test/src/unit-alt-string.cpp:32:
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:19047:55: note: candidate: ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::operator ValueType() const [with ValueType = nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer> >; 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::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::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 /home/x/test/json-3.10.5/test/src/unit-alt-string.cpp:32:
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:13099:5: note: candidate: ‘nlohmann::detail::json_ref< <template-parameter-1-1> >::json_ref(Args&& ...) [with Args = {const nlohmann::basic_json<std::map, std::vector, std::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> > >&}; typename std::enable_if<std::is_constructible<BasicJsonType, Args ...>::value, int>::type <anonymous> = 0; BasicJsonType = nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>]’
     json_ref(Args && ... args)
     ^~~~~~~~
In file included from /home/x/test/json-3.10.5/test/src/unit-alt-string.cpp:32:
/home/x/test/json-3.10.5/single_include/nlohmann/json.hpp:18059:5: note:   initializing argument 1 of ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::basic_json(nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::initializer_list_t, bool, nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_t) [with ObjectType = std::map; ArrayType = std::vector; StringType = alt_string; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::initializer_list_t = std::initializer_list<nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, alt_string, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer> > >; nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::value_t = nlohmann::detail::value_t]’
     basic_json(initializer_list_t init,
     ^~~~~~~~~~
gmake[2]: *** [test/CMakeFiles/test-alt-string.dir/build.make:76: test/CMakeFiles/test-alt-string.dir/src/unit-alt-string.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:2048: test/CMakeFiles/test-alt-string.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2


Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions