After that build of my Android application using clang 3.8.275480 break with this error:
After checking the develop version (as instructed at the bottom of the bug report form), I have concluded that this issue is already solved in the develop branch.
I'm still creating this ticket so other people who have this issue can find it, and possibly to be able to refer to it if develop will get unfixed at a later date.
The build should complete without errors, instead we get a build error (see below).
With `json.hpp` from releases 3.10.4 and 3.10.5, the following error output is emitted by the clang command show above:
In file included from test-json.cpp:1:
./json.hpp:4042:7: error: overload resolution selected deleted operator '='
s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./json.hpp:4401:16: note: in instantiation of function template specialization 'nlohmann::detail::from_json<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >, nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > >, 0>' requested here
return from_json(j, std::forward<T>(val));
^
./json.hpp:5060:9: note: in instantiation of function template specialization 'nlohmann::detail::from_json_fn::operator()<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >, nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > > &>' requested here
::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
^
./json.hpp:20574:36: note: in instantiation of function template specialization 'nlohmann::adl_serializer<nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > >, void>::from_json<const nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > &, nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > > >' requested here
JSONSerializer<ValueType>::from_json(*this, ret);
^
./json.hpp:20717:16: note: in instantiation of function template specialization 'nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >::get_impl<nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > >, 0>' requested here
return get_impl<ValueType>(detail::priority_tag<4> {});
^
./json.hpp:13488:15: note: candidate function has been explicitly deleted
json_ref& operator=(json_ref&&) = delete;
^
./json.hpp:13487:15: note: candidate function has been explicitly deleted
json_ref& operator=(const json_ref&) = delete;
^
In file included from test-json.cpp:1:
In file included from ./json.hpp:37:
In file included from /home/odeda/.local/Android/android-ndk-r14b/sources/cxx-stl/llvm-libc++/include/algorithm:634:
In file included from /home/odeda/.local/Android/android-ndk-r14b/sources/cxx-stl/llvm-libc++/include/memory:606:
/home/odeda/.local/Android/android-ndk-r14b/sources/cxx-stl/llvm-libc++/include/iterator:746:28: error: no member named 'insert' in 'std::initializer_list<nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > > >'
{iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;}
~~~~~~~~~ ^
/home/odeda/.local/Android/android-ndk-r14b/sources/cxx-stl/llvm-libc++/include/algorithm:1957:19: note: in instantiation of member function 'std::__ndk1::insert_iterator<std::initializer_list<nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > > > >::operator=' requested here
*__result = __op(*__first);
^
./json.hpp:4167:10: note: in instantiation of function template specialization 'std::__ndk1::transform<nlohmann::detail::iter_impl<const nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > >, std::__ndk1::insert_iterator<std::initializer_list<nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > > > >, (lambda at ./json.hpp:4169:9)>' requested here
std::transform(
^
./json.hpp:4196:5: note: in instantiation of function template specialization 'nlohmann::detail::from_json_array_impl<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >, std::initializer_list<nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > > >, 0>' requested here
from_json_array_impl(j, arr, priority_tag<3> {});
^
./json.hpp:4401:16: note: in instantiation of function template specialization 'nlohmann::detail::from_json<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >, std::initializer_list<nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > > >, 0>' requested here
return from_json(j, std::forward<T>(val));
^
./json.hpp:5060:9: note: in instantiation of function template specialization 'nlohmann::detail::from_json_fn::operator()<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >, std::initializer_list<nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > > > &>' requested here
::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
^
./json.hpp:20574:36: note: in instantiation of function template specialization 'nlohmann::adl_serializer<std::initializer_list<nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > > >, void>::from_json<const nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > &, std::initializer_list<nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > > > >' requested here
JSONSerializer<ValueType>::from_json(*this, ret);
^
./json.hpp:20717:16: note: in instantiation of function template specialization 'nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >::get_impl<std::initializer_list<nlohmann::detail::json_ref<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > > >, 0>' requested here
return get_impl<ValueType>(detail::priority_tag<4> {});
^
./json.hpp:4042:9: error: cannot pass object of non-trivial type 'const string_t' (aka 'const std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >') through variadic constructor; call will abort at runtime
s = *j.template get_ptr<const typename BasicJsonType::string_t*>();
^
./json.hpp:4401:16: note: in instantiation of function template specialization 'nlohmann::detail::from_json<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >, std::__ndk1::__any, 0>' requested here
return from_json(j, std::forward<T>(val));
^
./json.hpp:5060:9: note: in instantiation of function template specialization 'nlohmann::detail::from_json_fn::operator()<nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >, std::__ndk1::__any &>' requested here
::nlohmann::from_json(std::forward<BasicJsonType>(j), val);
^
./json.hpp:20574:36: note: in instantiation of function template specialization 'nlohmann::adl_serializer<std::__ndk1::__any, void>::from_json<const nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > > &, std::__ndk1::__any>' requested here
JSONSerializer<ValueType>::from_json(*this, ret);
^
./json.hpp:20717:16: note: in instantiation of function template specialization 'nlohmann::basic_json<std::map, std::vector, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> >, bool, long, unsigned long, double, std::allocator, adl_serializer, std::__ndk1::vector<unsigned char, std::__ndk1::allocator<unsigned char> > >::get_impl<std::__ndk1::__any, 0>' requested here
return get_impl<ValueType>(detail::priority_tag<4> {});
^
3 errors generated.
Description
I've added the
json.hppfile - as downloaded directly from the releases page - to my project and included it in one of my.cppfiles. No other modification was done - the code itself is not used anyway, not even the recommendedusinginstruction was added.After that build of my Android application using clang 3.8.275480 break with this error:
Note:
After checking the develop version (as instructed at the bottom of the bug report form), I have concluded that this issue is already solved in the
developbranch.I'm still creating this ticket so other people who have this issue can find it, and possibly to be able to refer to it if
developwill get unfixed at a later date.Reproduction steps
json.hppof version 3.10.4 or 3.10.5 and add it to your project.-std=c++14Expected vs. actual results
The build should complete without errors, instead we get a build error (see below).
Minimal code example
NDKROOT=/where/you/have/android-ndk-r14b;
SYSROOT=$NDKROOT/platforms/android-21/arch-x86_64;
LLVM_ARCH_LIBS=$NDKROOT/sources/cxx-stl/llvm-libc++/libs/x86_64/;
$NDKROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -cc1
-triple x86_64-none-linux-android
-I $NDKROOT/sources/cxx-stl/llvm-libc++/include
-I $SYSROOT/usr/include
-I $NDKROOT/toolchains/llvm/prebuilt/linux-x86_64/lib64/clang/3.8.275480/include
-std=c++14
-o test-json.cpp.o test-json.cpp
Error messages