Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC 9.0 build failure #1472

Closed
xvitaly opened this issue Feb 2, 2019 · 3 comments
Closed

GCC 9.0 build failure #1472

xvitaly opened this issue Feb 2, 2019 · 3 comments

Comments

@xvitaly
Copy link
Contributor

xvitaly commented Feb 2, 2019

  • What is the issue you have?

Build failure using GCC 9.0 compiler on Fedora 30.

  • Please describe the steps to reproduce the issue. Can you provide a small but working code example?

Run build under GCC 9.0.

  • What is the expected behavior?

Successful build.

  • And what is the actual behavior instead?

Build failure:

[13/77] /usr/bin/c++  -DCATCH_CONFIG_FAST_COMPILE -I../test/thirdparty/catch -I../test/thirdparty/fifo_map -I../single_include -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection   -Wno-deprecated -Wno-float-equal -Wno-deprecated-declarations -std=gnu++11 -MD -MT test/CMakeFiles/test-allocator.dir/src/unit-allocator.cpp.o -MF test/CMakeFiles/test-allocator.dir/src/unit-allocator.cpp.o.d -o test/CMakeFiles/test-allocator.dir/src/unit-allocator.cpp.o -c ../test/src/unit-allocator.cpp
FAILED: test/CMakeFiles/test-allocator.dir/src/unit-allocator.cpp.o 
/usr/bin/c++  -DCATCH_CONFIG_FAST_COMPILE -I../test/thirdparty/catch -I../test/thirdparty/fifo_map -I../single_include -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection   -Wno-deprecated -Wno-float-equal -Wno-deprecated-declarations -std=gnu++11 -MD -MT test/CMakeFiles/test-allocator.dir/src/unit-allocator.cpp.o -MF test/CMakeFiles/test-allocator.dir/src/unit-allocator.cpp.o.d -o test/CMakeFiles/test-allocator.dir/src/unit-allocator.cpp.o -c ../test/src/unit-allocator.cpp
In file included from /usr/include/c++/9/vector:67,
                 from ../test/thirdparty/catch/catch.hpp:677,
                 from ../test/src/unit-allocator.cpp:30:
/usr/include/c++/9/bits/stl_vector.h: In instantiation of 'void std::vector<_Tp, _Alloc>::_M_range_initialize(_ForwardIterator, _ForwardIterator, std::forward_iterator_tag) [with _ForwardIterator = __gnu_cxx::__normal_iterator<const std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >; _Tp = nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>; _Alloc = my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> >]':
/usr/include/c++/9/bits/stl_vector.h:621:4:   required from 'std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = __gnu_cxx::__normal_iterator<const std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >; <template-parameter-2-2> = void; _Tp = nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>; _Alloc = my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> >; std::vector<_Tp, _Alloc>::allocator_type = my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> >]'
../test/src/unit-allocator.cpp:84:13:   required from 'void my_allocator<T>::construct(T*, Args&& ...) [with Args = {__gnu_cxx::__normal_iterator<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, __gnu_cxx::__normal_iterator<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >}; T = std::vector<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>, my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> > >]'
/usr/include/c++/9/bits/alloc_traits.h:244:4:   required from 'static std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> std::allocator_traits<_Alloc>::_S_construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::vector<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>, my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> > >; _Args = {__gnu_cxx::__normal_iterator<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, __gnu_cxx::__normal_iterator<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >}; _Alloc = my_allocator<std::vector<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>, my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> > > >; std::_Require<typename std::allocator_traits<_Alloc>::__construct_helper<_Tp, _Args>::type> = void]'
/usr/include/c++/9/bits/alloc_traits.h:351:16:   required from 'static decltype (std::allocator_traits<_Alloc>::_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) std::allocator_traits<_Alloc>::construct(_Alloc&, _Tp*, _Args&& ...) [with _Tp = std::vector<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>, my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> > >; _Args = {__gnu_cxx::__normal_iterator<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, __gnu_cxx::__normal_iterator<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >}; _Alloc = my_allocator<std::vector<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>, my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> > > >; decltype (std::allocator_traits<_Alloc>::_S_construct(__a, __p, (forward<_Args>)(std::allocator_traits::construct::__args)...)) = void]'
../single_include/nlohmann/json.hpp:13214:35:   required from 'static T* nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::create(Args&& ...) [with T = std::vector<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>, my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> > >; Args = {__gnu_cxx::__normal_iterator<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, __gnu_cxx::__normal_iterator<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >}; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = my_allocator; JSONSerializer = nlohmann::adl_serializer]'
../single_include/nlohmann/json.hpp:1927:25:   required from 'static void nlohmann::detail::external_constructor<nlohmann::detail::value_t::array>::construct(BasicJsonType&, const CompatibleArrayType&) [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>; CompatibleArrayType = std::vector<std::__cxx11::basic_string<char> >; typename std::enable_if<(! std::is_same<CompatibleArrayType, typename BasicJsonType::array_t>::value), int>::type <anonymous> = 0]'
../single_include/nlohmann/json.hpp:2057:52:   required from 'void nlohmann::detail::to_json(BasicJsonType&, const CompatibleArrayType&) [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>; CompatibleArrayType = std::vector<std::__cxx11::basic_string<char> >; 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, ConstructibleStringType>::value)) && (! nlohmann::detail::is_basic_json<T>::value)), int>::type <anonymous> = 0]'
../single_include/nlohmann/json.hpp:2128: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, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>; T = std::vector<std::__cxx11::basic_string<char> >&; decltype ((nlohmann::detail::to_json(j, forward<T>(val)), void())) = void]'
../single_include/nlohmann/json.hpp:12446:28:   required from 'static decltype ((nlohmann::{anonymous}::to_json(j, forward<ValueType>(val)), void())) nlohmann::adl_serializer<T, SFINAE>::to_json(BasicJsonType&, ValueType&&) [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>; ValueType = std::vector<std::__cxx11::basic_string<char> >&; <template-parameter-1-1> = std::vector<std::__cxx11::basic_string<char> >; <template-parameter-1-2> = void; decltype ((nlohmann::{anonymous}::to_json(j, forward<ValueType>(val)), void())) = void]'
../single_include/nlohmann/json.hpp:13633:35:   required from 'nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer>::basic_json(CompatibleType&&) [with CompatibleType = std::vector<std::__cxx11::basic_string<char> >&; U = std::vector<std::__cxx11::basic_string<char> >; 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>, U>::value), int>::type <anonymous> = 0; ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = my_allocator; JSONSerializer = nlohmann::adl_serializer]'
../test/src/unit-allocator.cpp:197:13:   required from here
/usr/include/c++/9/bits/stl_vector.h:1546:43: error: cannot convert 'std::_Vector_base<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>, my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> > >::_Tp_alloc_type' {aka 'std::allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> >'} to 'const allocator_type&' {aka 'const my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> >&'}
 1546 |      = this->_M_allocate(_S_check_init_len(__n, _M_get_Tp_allocator()));
      |                          ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1731:62: note:   initializing argument 2 of 'static std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::_S_check_init_len(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator>; _Alloc = my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = my_allocator<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char>, bool, long int, long unsigned int, double, my_allocator> >]'
 1731 |       _S_check_init_len(size_type __n, const allocator_type& __a)
      |                                        ~~~~~~~~~~~~~~~~~~~~~~^~~

Full build log: https://kojipkgs.fedoraproject.org//work/tasks/3159/32413159/build.log

GCC 9.0.

  • Did you use a released version of the library or the version from the develop branch?

3.5.0

@theodelrieu
Copy link
Contributor

theodelrieu commented Feb 4, 2019

Hello, could you try adding the following lines in my_allocator in unit-allocator.cpp?

template <typename U>
struct rebind {
  using other = my_allocator<U>;
};

@stale
Copy link

stale bot commented Mar 6, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Mar 6, 2019
@nlohmann nlohmann removed the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Mar 10, 2019
nlohmann added a commit that referenced this issue Mar 11, 2019
Fix gcc9 build error test/src/unit-allocator.cpp (Issue #1472)
@nlohmann nlohmann self-assigned this Mar 11, 2019
@nlohmann nlohmann added this to the Release 3.6.0 milestone Mar 11, 2019
@nlohmann
Copy link
Owner

Fixed by merging #1492.

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

No branches or pull requests

3 participants