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 get tons of errors and warnings. Ditto when I try and use g++-13 or clang++-17 on macOS. Build always fails with various warnings and errors. See attached example errors.
Reproduction steps
be on macOS Sonoma 14.1.1 with macports.
git pull to get v3.11.2
mkdir build && cd build
cmake -GNinja .. && ninja
See errors.
Expected vs. actual results
Expected it to build and not fail.
Note that on the develop branch things work so idk maybe this is a dupe of a previous bug. Still.. considering you just did a release I would have expected stuff to work and not fail?
Minimal code example
No response
Error messages
[2/164] Building CXX object tests/CMakeFiles/test-allocator_cpp11.dir/src/unit-allocator.cpp.o
FAILED: tests/CMakeFiles/test-allocator_cpp11.dir/src/unit-allocator.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DDOCTEST_CONFIG_SUPER_FAST_ASSERTS -DJSON_TEST_KEEP_MACROS -DJSON_TEST_USING_MULTIPLE_HEADERS=1 -I/Users/calin/src/nlohmann-json/tests/thirdparty/doctest -I/Users/calin/src/nlohmann-json/tests/thirdparty/fifo_map -I/Users/calin/src/nlohmann-json/build/include -I/Users/calin/src/nlohmann-json/include -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -Wno-deprecated -Wno-float-equal -std=gnu++11 -MD -MT tests/CMakeFiles/test-allocator_cpp11.dir/src/unit-allocator.cpp.o -MF tests/CMakeFiles/test-allocator_cpp11.dir/src/unit-allocator.cpp.o.d -o tests/CMakeFiles/test-allocator_cpp11.dir/src/unit-allocator.cpp.o -c /Users/calin/src/nlohmann-json/tests/src/unit-allocator.cpp
In file included from /Users/calin/src/nlohmann-json/tests/src/unit-allocator.cpp:12:
In file included from /Users/calin/src/nlohmann-json/include/nlohmann/json.hpp:35:
In file included from /Users/calin/src/nlohmann-json/include/nlohmann/adl_serializer.hpp:14:
In file included from /Users/calin/src/nlohmann-json/include/nlohmann/detail/conversions/from_json.hpp:15:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/map:1007:5: error: static assertion failed due to requirement 'is_same<(anonymous namespace)::bad_allocator<std::pair<const std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char>>>>>, std::allocator<std::pair<const std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char>>>>>>::value': [allocator.requirements] states that rebinding an allocator to the same type should result in the original allocator
static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type>>::value,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/calin/src/nlohmann-json/include/nlohmann/detail/meta/type_traits.hpp:166:1: note: in instantiation of template class 'std::map<std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>, std::less<std::string>, (anonymous namespace)::bad_allocator<std::pair<const std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>>>' requested here
using detect_key_compare = typename T::key_compare;
^
/Users/calin/src/nlohmann-json/include/nlohmann/detail/meta/detected.hpp:41:33: note: in instantiation of template typealias'detect_key_compare' requested here
struct detector<Default, void_t<Op<Args...>>, Op, Args...>
^
/Users/calin/src/nlohmann-json/include/nlohmann/detail/meta/detected.hpp:48:1: note: during template argument deduction for class template partial specialization 'detector<Default, void_t<Op<Args...>>, Op, Args...>' [with Default = nlohmann::detail::nonesuch, Op = nlohmann::detail::detect_key_compare, Args =<std::map<std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>, std::less<std::string>, (anonymous namespace)::bad_allocator<std::pair<const std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>>>>]
using is_detected = typename detector<nonesuch, void, Op, Args...>::value_t;
^
/Users/calin/src/nlohmann-json/include/nlohmann/detail/meta/detected.hpp:48:1: note: in instantiation of template class 'nlohmann::detail::detector<nlohmann::detail::nonesuch, void, nlohmann::detail::detect_key_compare, std::map<std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>, std::less<std::string>, (anonymous namespace)::bad_allocator<std::pair<const std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>>>>' requested here
/Users/calin/src/nlohmann-json/include/nlohmann/detail/meta/type_traits.hpp:169:55: note: in instantiation of template typealias'is_detected' requested here
struct has_key_compare : std::integral_constant<bool, is_detected<detect_key_compare, T>::value> {};
^
/Users/calin/src/nlohmann-json/include/nlohmann/detail/meta/type_traits.hpp:177:46: note: in instantiation of template class 'nlohmann::detail::has_key_compare<std::map<std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>, std::less<std::string>, (anonymous namespace)::bad_allocator<std::pair<const std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>>>>' requested here
using type = typename std::conditional < has_key_compare<object_t>::value,
^
/Users/calin/src/nlohmann-json/include/nlohmann/detail/meta/type_traits.hpp:182:1: note: in instantiation of template class 'nlohmann::detail::actual_object_comparator<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>' requested here
using actual_object_comparator_t = typename actual_object_comparator<BasicJsonType>::type;
^
/Users/calin/src/nlohmann-json/include/nlohmann/json.hpp:369:41: note: in instantiation of template typealias'actual_object_comparator_t' requested here
using object_comparator_t = detail::actual_object_comparator_t<basic_json>;
^
/Users/calin/src/nlohmann-json/tests/src/unit-allocator.cpp:46:34: note: in instantiation of template class 'nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>' requested here
CHECK_THROWS_AS(bad_json(bad_json::value_t::object), std::bad_alloc&);
^
In file included from /Users/calin/src/nlohmann-json/tests/src/unit-allocator.cpp:12:
In file included from /Users/calin/src/nlohmann-json/include/nlohmann/json.hpp:21:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/algorithm:1913:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/chrono:746:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__chrono/convert_to_tm.h:19:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__chrono/statically_widen.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__format/concepts.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__format/format_parse_context.h:15:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/string_view:1027:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/functional:515:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/__functional/boyer_moore_searcher.h:26:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/include/c++/v1/vector:372:5: error: static assertion failed due to requirement 'is_same<(anonymous namespace)::bad_allocator<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char>>>>, std::allocator<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char>>>>>::value': [allocator.requirements] states that rebinding an allocator to the same type should result in the original allocator
static_assert(is_same<allocator_type, __rebind_alloc<__alloc_traits, value_type>>::value,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/calin/src/nlohmann-json/include/nlohmann/detail/iterators/iter_impl.hpp:64:111: note: in instantiation of template class 'std::vector<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>, (anonymous namespace)::bad_allocator<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>>' requested here
&& std::is_base_of<std::bidirectional_iterator_tag, typename std::iterator_traits<typename array_t::iterator>::iterator_category>::value,
^
/Users/calin/src/nlohmann-json/include/nlohmann/json.hpp:730:48: note: in instantiation of template class 'nlohmann::detail::iter_impl<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>' requested here
iterator set_parents(iterator it, typename iterator::difference_type count_set_parents)
^
/Users/calin/src/nlohmann-json/tests/src/unit-allocator.cpp:46:34: note: in instantiation of template class 'nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>' requested here
CHECK_THROWS_AS(bad_json(bad_json::value_t::object), std::bad_alloc&);
^
In file included from /Users/calin/src/nlohmann-json/tests/src/unit-allocator.cpp:12:
In file included from /Users/calin/src/nlohmann-json/include/nlohmann/json.hpp:45:
/Users/calin/src/nlohmann-json/include/nlohmann/detail/iterators/internal_iterator.hpp:27:39: error: no type named 'iterator'in'std::map<std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>, std::less<std::string>, (anonymous namespace)::bad_allocator<std::pair<const std::string, nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>>>'
typename BasicJsonType::object_t::iterator object_iterator {};~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/Users/calin/src/nlohmann-json/include/nlohmann/detail/iterators/iter_impl.hpp:747:72: note: in instantiation of template class 'nlohmann::detail::internal_iterator<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>' requested here
internal_iterator<typename std::remove_const<BasicJsonType>::type> m_it {};
^
/Users/calin/src/nlohmann-json/include/nlohmann/json.hpp:730:48: note: in instantiation of template class 'nlohmann::detail::iter_impl<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>' requested here
iterator set_parents(iterator it, typename iterator::difference_type count_set_parents)
^
/Users/calin/src/nlohmann-json/tests/src/unit-allocator.cpp:46:34: note: in instantiation of template class 'nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>' requested here
CHECK_THROWS_AS(bad_json(bad_json::value_t::object), std::bad_alloc&);
^
In file included from /Users/calin/src/nlohmann-json/tests/src/unit-allocator.cpp:12:
/Users/calin/src/nlohmann-json/include/nlohmann/json.hpp:564:42: error: no member named 'size'in'std::vector<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>, (anonymous namespace)::bad_allocator<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>>'stack.reserve(array->size());
~~~~~ ^
/Users/calin/src/nlohmann-json/include/nlohmann/json.hpp:1243:17: note: in instantiation of member function'nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>::json_value::destroy' requested here m_value.destroy(m_type); ^/Users/calin/src/nlohmann-json/tests/src/unit-allocator.cpp:46:25: note: in instantiation of member function 'nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>::~basic_json' requested here CHECK_THROWS_AS(bad_json(bad_json::value_t::object), std::bad_alloc&); ^In file included from /Users/calin/src/nlohmann-json/tests/src/unit-allocator.cpp:12:/Users/calin/src/nlohmann-json/include/nlohmann/json.hpp:565:38: error: no member named 'begin' in 'std::vector<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>, (anonymous namespace)::bad_allocator<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>>' std::move(array->begin(), array->end(), std::back_inserter(stack)); ~~~~~ ^/Users/calin/src/nlohmann-json/include/nlohmann/json.hpp:586:63: error: no member named 'begin' in 'std::vector<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>, (anonymous namespace)::bad_allocator<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>>' std::move(current_item.m_value.array->begin(), current_item.m_value.array->end(), std::back_inserter(stack)); ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^/Users/calin/src/nlohmann-json/include/nlohmann/json.hpp:588:53: error: no member named 'clear' in 'std::vector<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>, (anonymous namespace)::bad_allocator<nlohmann::basic_json<std::map, std::vector, std::string, bool, long long, unsigned long long, double, (anonymous namespace)::bad_allocator>>>' current_item.m_value.array->clear(); ~~~~~~~~~~~~~~~~~~~~~~~~~~ ^7 errors generated.[19/164] Building CXX object tests/CMakeFiles/test-bjdata_cpp11.dir/src/unit-bjdata.cpp.oninja: build stopped: subcommand failed.
### Compiler and operating system
Apple clang version 15.0.0 (clang-1500.0.40.1) on macOS Sonoma 14.1.1 using macports cmake
### Library version
3.11.2
### Validation
- [ ] The bug also occurs if the latest version from the [`develop`](https://github.com/nlohmann/json/tree/develop) branch is used.
- [ ] I can successfully [compile and run the unit tests](https://github.com/nlohmann/json#execute-unit-tests).
The text was updated successfully, but these errors were encountered:
Hmm... you're right. I was just on latest master which appears to be tagged v3.11.2. I just did git checkout v3.11.3 and did a build and it works now. My bad. Seems to be fixed on v3.11.3. Closing.
PS: Why not have master be.. you know.. like the latest release? Why all these crazy branches? What's the value in that? I never understand why some projects do these things... anyway.. sorry for the false report.
Description
I'm on macOS with macports. Latest master (which happens to be v3.11.2 release tag). I did:
I get tons of errors and warnings. Ditto when I try and use g++-13 or clang++-17 on macOS. Build always fails with various warnings and errors. See attached example errors.
Reproduction steps
Expected vs. actual results
Expected it to build and not fail.
Note that on the
develop
branch things work so idk maybe this is a dupe of a previous bug. Still.. considering you just did a release I would have expected stuff to work and not fail?Minimal code example
No response
Error messages
The text was updated successfully, but these errors were encountered: