You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on an update for the nix Debian package to 2.5.1. In Debian we try to avoid vendorized code, thus I use the already packaged nlohmann-json3 in version 3.10.4.
The nlohmann-json version in nix seems to be 3.9.1.
I see this compilation error:
src/libstore/realisation.cc: In lambda function: [14/9368]
src/libstore/realisation.cc:81:16: error: conversion from ‘const nlohmann::basic_json<>’ to ‘std::optional<std::__cxx11::basic_string<char> >’ is ambiguous
81 | return *fieldIterator;
| ^~~~~~~~~~~~~~
In file included from src/libstore/realisation.cc:4:
/usr/include/nlohmann/json.hpp:3413:55: note: candidate: ‘nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFl
oatType, AllocatorType, JSONSerializer, BinaryType>::operator ValueType() const [with ValueType = std::optional<std::__cxx11::basic_string<char> >; typename std::enable_if<nl
ohmann::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::detai
l::negation<std::is_same<ValueType, typename StringType::value_type> >, nlohmann::detail::negation<nlohmann::detail::is_basic_json<BasicJsonType> >, nlohmann::detail::negatio
n<std::is_same<ValueType, std::initializer_list<typename StringType::value_type> > >, nlohmann::detail::negation<std::is_same<ValueType, std::basic_string_view<char, std::cha
r_traits<char> > > >, nlohmann::detail::is_detected_lazy<nlohmann::detail::get_template_function, const nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, N
umberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>&, ValueType> >::value, int>::type <anonymous> = 0; ObjectType = std::map; Ar
rayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatTyp
e = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>]’
3413 | JSON_EXPLICIT operator ValueType() const
| ^~~~~~~~
In file included from src/libutil/error.hh:11,
from src/libutil/util.hh:4,
from src/libutil/serialise.hh:6,
from src/libutil/hash.hh:4,
from src/libstore/content-address.hh:4,
from src/libstore/path.hh:3,
from src/libstore/realisation.hh:3,
from src/libstore/realisation.cc:1:
/usr/include/c++/11/optional:704:9: note: candidate: ‘constexpr std::optional<_Tp>::optional(_Up&&) [with _Up = const nlohmann::basic_json<>&; typename std::enable_if<__and_v
<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Tp>::type>::type> >, std::__not_<std::is_same<std::in_place_t, typename
std::remove_cv<typename std::remove_reference<_Tp>::type>::type> >, std::is_constructible<_Tp, _Up>, std::is_convertible<_Up, _Tp> >, bool>::type <anonymous> = true; _Tp = st
d::__cxx11::basic_string<char>]’
704 | optional(_Up&& __t)
| ^~~~~~~~
make[1]: *** [mk/patterns.mk:3: src/libstore/realisation.o] Error 1
I'm not a C++ programmer, so please don't laugh. I'd guess that one would simply need to tell the compiler, which conversion to use?
I tried compilation now with nlohmann version 3.9.1 from Debian and this error did not appear anymore. Version 3.10.5 of nlohmann-json3 has been uploaded to Debian unstable today and I'll test this one and report back.
I'm working on an update for the nix Debian package to 2.5.1. In Debian we try to avoid vendorized code, thus I use the already packaged nlohmann-json3 in version 3.10.4.
The nlohmann-json version in nix seems to be 3.9.1.
I see this compilation error:
I'm not a C++ programmer, so please don't laugh. I'd guess that one would simply need to tell the compiler, which conversion to use?
This is the code in question from src/libstore/realisation.cc#L81:
Is this related? nlohmann/json#3204
The text was updated successfully, but these errors were encountered: