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

Can't build with gcc13 #25

Open
AndreyMlashkin opened this issue Apr 5, 2024 · 1 comment
Open

Can't build with gcc13 #25

AndreyMlashkin opened this issue Apr 5, 2024 · 1 comment

Comments

@AndreyMlashkin
Copy link

Cpp 20 flag already set in CMakeLists:
set(CMAKE_CXX_STANDARD 20)

Here is the build log:

$ cmake --build . 
[ 72%] Built target compile_test
Consolidate compiler generated dependencies of target unit_test
[ 73%] Building CXX object CMakeFiles/unit_test.dir/tc/dense_map.t.cpp.o
In file included from /home/andrei/sources/think-cell-library/tc/base/casts.h:12,
                 from /home/andrei/sources/think-cell-library/tc/base/reference_or_value.h:13,
                 from /home/andrei/sources/think-cell-library/tc/array.h:12,
                 from /home/andrei/sources/think-cell-library/tc/unittest.h:10,
                 from /home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:10:
/home/andrei/sources/think-cell-library/tc/base/functors.h:142:91: warning: friend declaration ‘tc::constant<true> tc::mem_fn_adl::returns_reference_to_argument(tc::mem_fn_adl::wrap_xvalue_by_ref<Lambda>)’ declares a non-template function [-Wnon-template-friend]
  142 |                 friend tc::constant<true> returns_reference_to_argument(wrap_xvalue_by_ref); // mark as returning reference to argument
      |                                                                                           ^
/home/andrei/sources/think-cell-library/tc/base/functors.h:142:91: note: (if this is not what you intended, make sure the function template has already been declared and add ‘<>’ after the function name here)
In file included from /home/andrei/sources/think-cell-library/tc/algorithm/../range/transform_adaptor.h:14,
                 from /home/andrei/sources/think-cell-library/tc/algorithm/compare.h:18,
                 from /home/andrei/sources/think-cell-library/tc/array.h:17,
                 from /home/andrei/sources/think-cell-library/tc/unittest.h:10,
                 from /home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:10:
/home/andrei/sources/think-cell-library/tc/algorithm/../range/range_adaptor.h:223:46: warning: friend declaration ‘tc::type::unique_t<tc::type::no_adl::list<typename tc::no_adl::remove_rvalue_reference<T>::type ...> > tc::generator_range_output_adaptor_adl::range_output_t_impl(const tc::generator_range_output_adaptor_adl::generator_range_output_adaptor<Rng, tc::type::no_adl::list<T ...> >&)’ declares a non-template function [-Wnon-template-friend]
  223 |                                 -> tc::type::unique_t<tc::type::list<tc::remove_rvalue_reference_t<T>...>>; // declaration only
      |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/andrei/sources/think-cell-library/tc/algorithm/../base/../range/iota_range.h:11,
                 from /home/andrei/sources/think-cell-library/tc/algorithm/../base/invoke_with_constant.h:14,
                 from /home/andrei/sources/think-cell-library/tc/algorithm/../variant.h:16,
                 from /home/andrei/sources/think-cell-library/tc/algorithm/quantifier.h:13,
                 from /home/andrei/sources/think-cell-library/tc/array.h:20,
                 from /home/andrei/sources/think-cell-library/tc/unittest.h:10,
                 from /home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:10:
/home/andrei/sources/think-cell-library/tc/algorithm/../base/../range/../algorithm/element.h:203:92: warning: friend declaration ‘tc::constant<true> tc::fn_front_adl::returns_reference_to_argument(tc::fn_front_adl::fn_front<RangeReturn>)’ declares a non-template function [-Wnon-template-friend]
  203 |                         friend tc::constant<true> returns_reference_to_argument(fn_ ## name); /*mark as returning reference to argument. */ \
      |                                                                                            ^
/home/andrei/sources/think-cell-library/tc/algorithm/../base/../range/../algorithm/element.h:216:9: note: in expansion of macro ‘RETURN_REFERENCE_FROM_ELEMENT’
  216 |         RETURN_REFERENCE_FROM_ELEMENT(front)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andrei/sources/think-cell-library/tc/algorithm/../base/../range/../algorithm/element.h:203:92: warning: friend declaration ‘tc::constant<true> tc::fn_back_adl::returns_reference_to_argument(tc::fn_back_adl::fn_back<RangeReturn>)’ declares a non-template function [-Wnon-template-friend]
  203 |                         friend tc::constant<true> returns_reference_to_argument(fn_ ## name); /*mark as returning reference to argument. */ \
      |                                                                                            ^
/home/andrei/sources/think-cell-library/tc/algorithm/../base/../range/../algorithm/element.h:217:9: note: in expansion of macro ‘RETURN_REFERENCE_FROM_ELEMENT’
  217 |         RETURN_REFERENCE_FROM_ELEMENT(back)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andrei/sources/think-cell-library/tc/algorithm/../base/../range/../algorithm/element.h:203:92: warning: friend declaration ‘tc::constant<true> tc::fn_linear_back_adl::returns_reference_to_argument(tc::fn_linear_back_adl::fn_linear_back<RangeReturn>)’ declares a non-template function [-Wnon-template-friend]
  203 |                         friend tc::constant<true> returns_reference_to_argument(fn_ ## name); /*mark as returning reference to argument. */ \
      |                                                                                            ^
/home/andrei/sources/think-cell-library/tc/algorithm/../base/../range/../algorithm/element.h:218:9: note: in expansion of macro ‘RETURN_REFERENCE_FROM_ELEMENT’
  218 |         RETURN_REFERENCE_FROM_ELEMENT(linear_back)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/andrei/sources/think-cell-library/tc/algorithm/../base/../range/../algorithm/element.h:203:92: warning: friend declaration ‘tc::constant<true> tc::fn_only_adl::returns_reference_to_argument(tc::fn_only_adl::fn_only<RangeReturn>)’ declares a non-template function [-Wnon-template-friend]
  203 |                         friend tc::constant<true> returns_reference_to_argument(fn_ ## name); /*mark as returning reference to argument. */ \
      |                                                                                            ^
/home/andrei/sources/think-cell-library/tc/algorithm/../base/../range/../algorithm/element.h:219:9: note: in expansion of macro ‘RETURN_REFERENCE_FROM_ELEMENT’
  219 |         RETURN_REFERENCE_FROM_ELEMENT(only)
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:10:
/home/andrei/sources/think-cell-library/tc/unittest.h:40:98: warning: friend declaration ‘tc::type::no_adl::list<T> tc::no_adl::range_output_t_impl(const tc::no_adl::chunk_range_adaptor<RngChunk, Rng>&)’ declares a non-template function [-Wnon-template-friend]
   40 |                         friend auto range_output_t_impl(chunk_range_adaptor const&) -> tc::type::list<RngChunk>; // declaration only
      |                                                                                                  ^~~~~~~~~~~~~~
In file included from /home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:11:
/home/andrei/sources/think-cell-library/tc/dense_map.h: In instantiation of ‘constexpr tc::dense_map_adl::dense_map<Key, Value>::dense_map(tc::no_adl::fill_tag_t, Args&& ...) [with Args = {int}; Key = MyEnum_adl::MyEnum; Value = NonCopyNonMoveable]’:
/home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:32:69:   required from here
/home/andrei/sources/think-cell-library/tc/dense_map.h:141:93: error: use of deleted function ‘std::array<NonCopyNonMoveable, 2>::array(std::array<NonCopyNonMoveable, 2>&&)’
  141 |                         : tc_member_init_cast(m_a, tc::fill_tag, tc_move_if_owned(val)...) {}
      |                                                                                             ^
In file included from /home/andrei/sources/think-cell-library/tc/base/explicit_cast_fwd.h:14,
                 from /home/andrei/sources/think-cell-library/tc/base/renew.h:12,
                 from /home/andrei/sources/think-cell-library/tc/base/reference_or_value.h:11,
                 from /home/andrei/sources/think-cell-library/tc/array.h:12,
                 from /home/andrei/sources/think-cell-library/tc/unittest.h:10,
                 from /home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:10:
/usr/include/c++/11/array:95:12: note: ‘std::array<NonCopyNonMoveable, 2>::array(std::array<NonCopyNonMoveable, 2>&&)’ is implicitly deleted because the default definition would be ill-formed:
   95 |     struct array
      |            ^~~~~
/usr/include/c++/11/array:95:12: error: use of deleted function ‘NonCopyNonMoveable::NonCopyNonMoveable(NonCopyNonMoveable&&)’
/home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:25:9: note: declared here
   25 |         NonCopyNonMoveable(NonCopyNonMoveable&&) = delete;
      |         ^~~~~~~~~~~~~~~~~~
In file included from /home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:11:
/home/andrei/sources/think-cell-library/tc/dense_map.h: In instantiation of ‘constexpr tc::dense_map_adl::dense_map<Key, Value>::dense_map(tc::no_adl::fill_tag_t, Args&& ...) [with Args = {const tc::no_adl::fill_tag_t&, int}; Key = MyEnum_adl::MyEnum; Value = tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>]’:
/home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:48:44:   required from here
/home/andrei/sources/think-cell-library/tc/dense_map.h:141:93: error: use of deleted function ‘std::array<tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>, 2>::array(std::array<tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>, 2>&&)’
  141 |                         : tc_member_init_cast(m_a, tc::fill_tag, tc_move_if_owned(val)...) {}
      |                                                                                             ^
In file included from /home/andrei/sources/think-cell-library/tc/base/explicit_cast_fwd.h:14,
                 from /home/andrei/sources/think-cell-library/tc/base/renew.h:12,
                 from /home/andrei/sources/think-cell-library/tc/base/reference_or_value.h:11,
                 from /home/andrei/sources/think-cell-library/tc/array.h:12,
                 from /home/andrei/sources/think-cell-library/tc/unittest.h:10,
                 from /home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:10:
/usr/include/c++/11/array:95:12: note: ‘std::array<tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>, 2>::array(std::array<tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>, 2>&&)’ is implicitly deleted because the default definition would be ill-formed:
   95 |     struct array
      |            ^~~~~
/usr/include/c++/11/array:95:12: error: use of deleted function ‘tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>::dense_map(tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>&&)’
In file included from /home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:11:
/home/andrei/sources/think-cell-library/tc/dense_map.h:112:24: note: ‘tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>::dense_map(tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>&&)’ is implicitly deleted because the default definition would be ill-formed:
  112 |                 struct dense_map {
      |                        ^~~~~~~~~
/home/andrei/sources/think-cell-library/tc/dense_map.h:112:24: error: use of deleted function ‘std::array<NonCopyNonMoveable, 2>::array(std::array<NonCopyNonMoveable, 2>&&)’
/home/andrei/sources/think-cell-library/tc/dense_map.h: In instantiation of ‘constexpr tc::dense_map_adl::dense_map<Key, Value>::dense_map(tc::no_adl::transform_tag_t, tc::dense_map_adl::dense_map<Key, Value>::other_dense_map<Value2>&&, Func) [with Func = dense_map_with_non_moveable_typeUnitTest()::<lambda(int)>; Value2 = int; Key = MyEnum_adl::MyEnum; Value = NonCopyNonMoveable; tc::dense_map_adl::dense_map<Key, Value>::other_dense_map<Value2> = tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, int>]’:
/home/andrei/sources/think-cell-library/tc/dense_map.h:208:4:   required from ‘constexpr tc::return_decltype_t<decltype (typename tc::dense_map_adl::dense_map<Key, Value>::transform_result<typename tc::no_adl::transform_value<Func, Value, void>::type, void>::type(tc::transform_tag, tc_move_always((*(tc::dense_map_adl::dense_map<Key, Value>*)this)), move_if_owned<decltype (func), tc::is_id_expression("func")>(func)))> tc::dense_map_adl::dense_map<Key, Value>::transform(Func&&) && [with long unsigned int nDepth = 0; Func = dense_map_with_non_moveable_typeUnitTest()::<lambda(int)>; std::enable_if_t<(0 == nDepth)>* <anonymous> = 0; Key = MyEnum_adl::MyEnum; Value = int; tc::return_decltype_t<decltype (typename tc::dense_map_adl::dense_map<Key, Value>::transform_result<typename tc::no_adl::transform_value<Func, Value, void>::type, void>::type(tc::transform_tag, tc_move_always((*(tc::dense_map_adl::dense_map<Key, Value>*)this)), move_if_owned<decltype (func), tc::is_id_expression("func")>(func)))> = tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>; decltype (typename tc::dense_map_adl::dense_map<Key, Value>::transform_result<typename tc::no_adl::transform_value<Func, Value, void>::type, void>::type(tc::transform_tag, tc_move_always((*(tc::dense_map_adl::dense_map<Key, Value>*)this)), move_if_owned<decltype (func), tc::is_id_expression("func")>(func))) = tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>; typename tc::dense_map_adl::dense_map<Key, Value>::transform_result<typename tc::no_adl::transform_value<Func, Value, void>::type, void>::type = tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>; typename tc::no_adl::transform_value<Func, Value, void>::type = std::decay<NonCopyNonMoveable>::type; decltype (func) = dense_map_with_non_moveable_typeUnitTest()::<lambda(int)>&&]’
/home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:55:92:   required from here
/home/andrei/sources/think-cell-library/tc/dense_map.h:206:26: error: use of deleted function ‘std::array<NonCopyNonMoveable, 2>::array(std::array<NonCopyNonMoveable, 2>&&)’
  206 |                         {}
      |                          ^
/home/andrei/sources/think-cell-library/tc/dense_map.h: In instantiation of ‘constexpr tc::dense_map_adl::dense_map<Key, Value>::dense_map(tc::no_adl::fill_tag_t, Args&& ...) [with Args = {const int}; Key = MyEnum_adl::MyEnum; Value = NonCopyNonMoveable]’:
/home/andrei/sources/think-cell-library/tc/base/explicit_cast_fwd.h:112:3:   required from ‘constexpr std::remove_cv_t<_Tp> tc::explicit_cast(Args&& ...) [with TTarget = tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>; Args = {const tc::no_adl::fill_tag_t&, const int}; std::remove_cv_t<_Tp> = tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>]’
/home/andrei/sources/think-cell-library/tc/array.h:175:50:   required from ‘constexpr std::array<_Tp, _Nm> tc::explicit_convert_std_array_detail::with_fill_tag_impl(tc::type::no_adl::identity<std::array<_Tp, _Nm> >, std::index_sequence<_Idx ...>, Args&& ...) [with T = tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>; long unsigned int N = 2; long unsigned int ...IndexPack = {0}; Args = {const tc::no_adl::fill_tag_t&, int}; std::index_sequence<_Idx ...> = std::integer_sequence<long unsigned int, 0>]’
/home/andrei/sources/think-cell-library/tc/array.h:205:68:   required from ‘constexpr std::array<_Tp, _Nm> tc::explicit_convert_adl::explicit_convert_impl(tc::explicit_convert_adl::adl_tag_t, tc::type::no_adl::identity<std::array<_Tp, _Nm> >, tc::no_adl::fill_tag_t, Args&& ...) [with T = tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>; long unsigned int N = 2; Args = {const tc::no_adl::fill_tag_t&, int}]’
/home/andrei/sources/think-cell-library/tc/base/explicit_cast_fwd.h:104:2:   required from ‘constexpr decltype(auto) tc::explicit_convert(Args&& ...) [with Args = {tc::type::no_adl::identity<std::array<tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>, 2> >, const tc::no_adl::fill_tag_t&, const tc::no_adl::fill_tag_t&, int}]’
/home/andrei/sources/think-cell-library/tc/base/explicit_cast_fwd.h:108:3:   required by substitution of ‘template<class TTarget, class ... Args, std::enable_if_t<(! safely_constructible_from<typename std::remove_cv< <template-parameter-1-1> >::type, Args&& ...>)>* <anonymous> > constexpr tc::return_decltype_t<decltype (tc::explicit_convert(tc::type::no_adl::identity<typename std::remove_cv< <template-parameter-1-1> >::type>(), (move_if_owned<decltype(tc::explicit_cast::args), is_id_expression()("args")>)(tc::explicit_cast::args)...))> tc::explicit_cast(Args&& ...) [with TTarget = std::array<tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>, 2>; Args = {const tc::no_adl::fill_tag_t&, const tc::no_adl::fill_tag_t&, int}; std::enable_if_t<(! safely_constructible_from<typename std::remove_cv< <template-parameter-1-1> >::type, Args&& ...>)>* <anonymous> = 0]’
/home/andrei/sources/think-cell-library/tc/dense_map.h:141:6:   required from ‘constexpr tc::dense_map_adl::dense_map<Key, Value>::dense_map(tc::no_adl::fill_tag_t, Args&& ...) [with Args = {const tc::no_adl::fill_tag_t&, int}; Key = MyEnum_adl::MyEnum; Value = tc::dense_map_adl::dense_map<MyEnum_adl::MyEnum, NonCopyNonMoveable>]’
/home/andrei/sources/think-cell-library/tc/dense_map.t.cpp:48:44:   required from here
/home/andrei/sources/think-cell-library/tc/dense_map.h:141:93: error: use of deleted function ‘std::array<NonCopyNonMoveable, 2>::array(std::array<NonCopyNonMoveable, 2>&&)’
  141 |                         : tc_member_init_cast(m_a, tc::fill_tag, tc_move_if_owned(val)...) {}
      |                                                                                             ^
gmake[2]: *** [CMakeFiles/unit_test.dir/build.make:454: CMakeFiles/unit_test.dir/tc/dense_map.t.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:869: CMakeFiles/unit_test.dir/all] Error 2
gmake: *** [Makefile:101: all] Error 2
gcc --version
gcc (GCC) 13.2.0
@foonathan
Copy link
Collaborator

It compiles with GCC 13.2.1 for me, and I don't have access to GCC 13.2.0. The error just happens in a unit test for copy elision. I think it's easiest if you just delete that test until you can update the compiler.

The entire library is header only anyway, so you don't really need to build it with CMake; you can just set the include directories.

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

No branches or pull requests

2 participants