Description
Description
Build failure under GCC 13.
Reproduction steps
Run standard build with tests enabled against GCC 13.
Expected vs. actual results
[1/164] /usr/bin/g++ -DDOCTEST_CONFIG_SUPER_FAST_ASSERTS -DJSON_TEST_KEEP_MACROS -DJSON_TEST_USING_MULTIPLE_HEADERS=1 -I/builddir/build/BUILD/json-3.11.2/tests/thirdparty/doctest -I/builddir/build/BUILD/json-3.11.2/tests/thirdparty/fifo_map -I/builddir/build/BUILD/json-3.11.2/redhat-linux-build/include -I/builddir/build/BUILD/json-3.11.2/include -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wno-deprecated -Wno-float-equal -Wno-deprecated-declarations -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 /builddir/build/BUILD/json-3.11.2/tests/src/unit-allocator.cpp
FAILED: tests/CMakeFiles/test-allocator_cpp11.dir/src/unit-allocator.cpp.o
/usr/bin/g++ -DDOCTEST_CONFIG_SUPER_FAST_ASSERTS -DJSON_TEST_KEEP_MACROS -DJSON_TEST_USING_MULTIPLE_HEADERS=1 -I/builddir/build/BUILD/json-3.11.2/tests/thirdparty/doctest -I/builddir/build/BUILD/json-3.11.2/tests/thirdparty/fifo_map -I/builddir/build/BUILD/json-3.11.2/redhat-linux-build/include -I/builddir/build/BUILD/json-3.11.2/include -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wno-deprecated -Wno-float-equal -Wno-deprecated-declarations -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 /builddir/build/BUILD/json-3.11.2/tests/src/unit-allocator.cpp
In file included from /usr/include/c++/13/ext/alloc_traits.h:34,
from /usr/include/c++/13/bits/basic_string.h:39,
from /usr/include/c++/13/string:54,
from /usr/include/c++/13/bits/locale_classes.h:40,
from /usr/include/c++/13/bits/ios_base.h:41,
from /usr/include/c++/13/streambuf:43,
from /usr/include/c++/13/bits/streambuf_iterator.h:35,
from /usr/include/c++/13/iterator:66,
from /builddir/build/BUILD/json-3.11.2/include/nlohmann/json.hpp:28,
from /builddir/build/BUILD/json-3.11.2/tests/src/unit-allocator.cpp:12:
/usr/include/c++/13/bits/alloc_traits.h: In instantiation of 'struct std::__allocator_traits_base::__rebind<{anonymous}::bad_allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> > >, std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> >, void>':
/usr/include/c++/13/bits/alloc_traits.h:94:11: required by substitution of 'template<class _Alloc, class _Up> using std::__alloc_rebind = typename std::__allocator_traits_base::__rebind<_Alloc, _Up>::type [with _Alloc = {anonymous}::bad_allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> > >; _Up = std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> >]'
/usr/include/c++/13/bits/alloc_traits.h:228:8: required by substitution of 'template<class _Alloc> template<class _Tp> using std::allocator_traits< <template-parameter-1-1> >::rebind_alloc = std::__alloc_rebind<_Alloc, _Tp> [with _Tp = std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> >; _Alloc = {anonymous}::bad_allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> > >]'
/usr/include/c++/13/ext/alloc_traits.h:126:65: required from 'struct __gnu_cxx::__alloc_traits<{anonymous}::bad_allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> > >, std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> > >::rebind<std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> > >'
/usr/include/c++/13/bits/stl_map.h:150:28: required from 'class std::map<std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator>, std::less<std::__cxx11::basic_string<char> >, {anonymous}::bad_allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> > > >'
/builddir/build/BUILD/json-3.11.2/include/nlohmann/detail/meta/type_traits.hpp:169:8: recursively required by substitution of 'template<class Default, template<class ...> class Op, class ... Args> struct nlohmann::json_abi_v3_11_2::detail::detector<Default, typename nlohmann::json_abi_v3_11_2::detail::make_void<Op<Args ...> >::type, Op, Args ...> [with Default = nlohmann::json_abi_v3_11_2::detail::nonesuch; Op = nlohmann::json_abi_v3_11_2::detail::detect_key_compare; Args = {std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, nlohmann::json_abi_v3_11_2::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, {anonymous}::bad_allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, {anonymous}::bad_allocator<std::pair<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, nlohmann::json_abi_v3_11_2::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, {anonymous}::bad_allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > > > >}]'
/builddir/build/BUILD/json-3.11.2/include/nlohmann/detail/meta/type_traits.hpp:169:8: required from 'struct nlohmann::json_abi_v3_11_2::detail::has_key_compare<std::map<std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator>, std::less<std::__cxx11::basic_string<char> >, {anonymous}::bad_allocator<std::pair<const std::__cxx11::basic_string<char>, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> > > > >'
/builddir/build/BUILD/json-3.11.2/include/nlohmann/detail/meta/type_traits.hpp:177:11: required from 'struct nlohmann::json_abi_v3_11_2::detail::actual_object_comparator<nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> >'
/builddir/build/BUILD/json-3.11.2/include/nlohmann/detail/meta/type_traits.hpp:182:7: required by substitution of 'template<class BasicJsonType> using nlohmann::json_abi_v3_11_2::detail::actual_object_comparator_t = typename nlohmann::json_abi_v3_11_2::detail::actual_object_comparator::type [with BasicJsonType = nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator>]'
/builddir/build/BUILD/json-3.11.2/include/nlohmann/json.hpp:369:11: required from 'class nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator>'
/builddir/build/BUILD/json-3.11.2/tests/src/unit-allocator.cpp:46:9: required from here
/usr/include/c++/13/bits/alloc_traits.h:70:31: error: static assertion failed: allocator_traits<A>::rebind_alloc<A::value_type> must be A
70 | _Tp>::value,
| ^~~~~
/usr/include/c++/13/bits/alloc_traits.h:70:31: note: 'std::integral_constant<bool, false>::value' evaluates to false
/usr/include/c++/13/bits/alloc_traits.h: In instantiation of 'struct std::__allocator_traits_base::__rebind<{anonymous}::bad_allocator<nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> >, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator>, void>':
/usr/include/c++/13/bits/alloc_traits.h:94:11: required by substitution of 'template<class _Alloc, class _Up> using std::__alloc_rebind = typename std::__allocator_traits_base::__rebind<_Alloc, _Up>::type [with _Alloc = {anonymous}::bad_allocator<nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> >; _Up = nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator>]'
/usr/include/c++/13/bits/alloc_traits.h:228:8: required by substitution of 'template<class _Alloc> template<class _Tp> using std::allocator_traits< <template-parameter-1-1> >::rebind_alloc = std::__alloc_rebind<_Alloc, _Tp> [with _Tp = nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator>; _Alloc = {anonymous}::bad_allocator<nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> >]'
/usr/include/c++/13/ext/alloc_traits.h:126:65: required from 'struct __gnu_cxx::__alloc_traits<{anonymous}::bad_allocator<nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> >, nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> >::rebind<nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> >'
/usr/include/c++/13/bits/stl_vector.h:88:21: required from 'struct std::_Vector_base<nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator>, {anonymous}::bad_allocator<nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> > >'
/usr/include/c++/13/bits/stl_vector.h:423:11: required from 'class std::vector<nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator>, {anonymous}::bad_allocator<nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> > >'
/builddir/build/BUILD/json-3.11.2/include/nlohmann/detail/iterators/iter_impl.hpp:64:151: required from 'class nlohmann::json_abi_v3_11_2::detail::iter_impl<nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator> >'
/builddir/build/BUILD/json-3.11.2/include/nlohmann/json.hpp:730:14: required from 'class nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, {anonymous}::bad_allocator>'
/builddir/build/BUILD/json-3.11.2/tests/src/unit-allocator.cpp:46:9: required from here
/usr/include/c++/13/bits/alloc_traits.h:70:31: error: static assertion failed: allocator_traits<A>::rebind_alloc<A::value_type> must be A
/usr/include/c++/13/bits/alloc_traits.h:70:31: note: 'std::integral_constant<bool, false>::value' evaluates to false
Minimal code example
No response
Error messages
error: static assertion failed: allocator_traits<A>::rebind_alloc<A::value_type> must be A
Compiler and operating system
GCC 13.0.0, Fedora Linux 38
Library version
3.11.2
Validation
- The bug also occurs if the latest version from the
develop
branch is used. - I can successfully compile and run the unit tests.