plowteam / donut

Open source reimplementation of The Simpsons: Hit & Run
GNU General Public License v3.0
421 stars 28 forks source link

Cannot build with newest g++ #7

Closed ccoors closed 5 years ago

ccoors commented 5 years ago

Environment: Arch Linux, g++ 9.1.0, building from master branch (ffe6c00719e12c2a4c6bfd18154e26e09cbc4239)

$ mkdir build
$ cd build
$ cmake ..
$ make -j
[...]
[ 20%] Building CXX object src/CMakeFiles/donut.dir/Level.cpp.o
In file included from /usr/include/c++/9.1.0/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
                 from /usr/include/c++/9.1.0/bits/allocator.h:46,
                 from /usr/include/c++/9.1.0/memory:63,
                 from /home/ccoors/dev/donut/src/Game.h:10,
                 from /home/ccoors/dev/donut/src/Level.cpp:3:
/usr/include/c++/9.1.0/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >; _Args = {const std::pair<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unique_ptr<Donut::Font, std::default_delete<Donut::Font> > >&}; _Tp = std::__detail::_Hash_node<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >, true>]’:
/usr/include/c++/9.1.0/bits/alloc_traits.h:482:2:   required from ‘static void std::allocator_traits<std::allocator<_Tp1> >::construct(std::allocator_traits<std::allocator<_Tp1> >::allocator_type&, _Up*, _Args&& ...) [with _Up = std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >; _Args = {const std::pair<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unique_ptr<Donut::Font, std::default_delete<Donut::Font> > >&}; _Tp = std::__detail::_Hash_node<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >, true>; std::allocator_traits<std::allocator<_Tp1> >::allocator_type = std::allocator<std::__detail::_Hash_node<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >, true> >]’
/usr/include/c++/9.1.0/bits/hashtable_policy.h:2075:36:   required from ‘std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_type* std::__detail::_Hashtable_alloc<_NodeAlloc>::_M_allocate_node(_Args&& ...) [with _Args = {const std::pair<const std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::unique_ptr<Donut::Font, std::default_delete<Donut::Font> > >&}; _NodeAlloc = std::allocator<std::__detail::_Hash_node<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >, true> >; std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_type = std::__detail::_Hash_node<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >, true>]’
/usr/include/c++/9.1.0/bits/hashtable.h:1243:46:   required from ‘std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>::_Hashtable(const std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>&) [with _Key = std::__cxx11::basic_string<char>; _Value = std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, std::unique_ptr<Donut::Font> > >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::__cxx11::basic_string<char> >; _H1 = std::hash<std::__cxx11::basic_string<char> >; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]’
/usr/include/c++/9.1.0/bits/unordered_map.h:181:7:   required from here
/usr/include/c++/9.1.0/ext/new_allocator.h:145:20: error: use of deleted function ‘constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = const std::__cxx11::basic_string<char>; _T2 = std::unique_ptr<Donut::Font>]’
  145 |  noexcept(noexcept(::new((void *)__p)
      |                    ^~~~~~~~~~~~~~~~~~
  146 |        _Up(std::forward<_Args>(__args)...)))
      |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/9.1.0/bits/stl_algobase.h:64,
                 from /usr/include/c++/9.1.0/memory:62,
                 from /home/ccoors/dev/donut/src/Game.h:10,
                 from /home/ccoors/dev/donut/src/Level.cpp:3:
/usr/include/c++/9.1.0/bits/stl_pair.h:303:17: note: ‘constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&) [with _T1 = const std::__cxx11::basic_string<char>; _T2 = std::unique_ptr<Donut::Font>]’ is implicitly deleted because the default definition would be ill-formed:
  303 |       constexpr pair(const pair&) = default;
      |                 ^~~~
/usr/include/c++/9.1.0/bits/stl_pair.h:303:17: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp>::unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = Donut::Font; _Dp = std::default_delete<Donut::Font>]’
In file included from /usr/include/c++/9.1.0/memory:80,
                 from /home/ccoors/dev/donut/src/Game.h:10,
                 from /home/ccoors/dev/donut/src/Level.cpp:3:
/usr/include/c++/9.1.0/bits/unique_ptr.h:411:7: note: declared here
  411 |       unique_ptr(const unique_ptr&) = delete;
      |       ^~~~~~~~~~
make[2]: *** [src/CMakeFiles/donut.dir/build.make:193: src/CMakeFiles/donut.dir/Level.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:4802: src/CMakeFiles/donut.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

My C++ skills are not good enough to fix this myself.

handsomematt commented 5 years ago

318e28c fixes this thank you