alandefreitas / clang-unformat

A simple tool to infer a .clang-format file from existing code
Boost Software License 1.0
58 stars 13 forks source link

Declaration of ... changes meaning of 'invoke' [-Wchanges-meaning] #16

Closed Maritsu closed 7 months ago

Maritsu commented 10 months ago

Attempting to build on Arch Linux x86_64 with Boost v1.83.0-2 and CMake v3.27.8, cmake --build . --target clang-unformat fails at building CMakeFiles/clang-unformat.dir/standalone/application.cpp.o with error code 2.

Appropriate chunk of build logs:

[ 89%] Building CXX object CMakeFiles/clang-unformat.dir/standalone/application.cpp.o
In file included from /home/bit/src/cp/clang-unformat/build/_deps/futures-src/source/futures/algorithm/detail/traits/range/range/concepts.h:32,
                 from /home/bit/src/cp/clang-unformat/build/_deps/futures-src/source/futures/futures/wait_for_all.h:12,
                 from /home/bit/src/cp/clang-unformat/build/_deps/futures-src/source/futures/futures.h:71,
                 from /home/bit/src/cp/clang-unformat/standalone/application.cpp:16:
/home/bit/src/cp/clang-unformat/build/_deps/futures-src/source/futures/algorithm/detail/traits/range/meta/meta.h:2390:57: error: declaration of ‘template<class Fn> template<class State, class A> using futures::detail::meta::ranges_detail::partition_<Fn>::invoke = futures
::detail::meta::_t<futures::detail::meta::ranges_detail::partition_<Fn>::impl<State, A> >’ changes meaning of ‘invoke’ [-Wchanges-meaning]
 2390 |             template <typename State, typename A> using invoke = _t<impl<State, A>>;
      |                                                         ^~~~~~
/home/bit/src/cp/clang-unformat/build/_deps/futures-src/source/futures/algorithm/detail/traits/range/meta/meta.h:2387:34: note: used here to mean ‘using futures::detail::meta::invoke = typename Fn::invoke<A>’
 2387 |                 using type = if_<invoke<Fn, A>, pair<list<Yes..., A>, list<No...>>, pair<list<Yes...>, list<No..., A>>>;
      |                                  ^~~~~~~~~~~~~
/home/bit/src/cp/clang-unformat/build/_deps/futures-src/source/futures/algorithm/detail/traits/range/meta/meta.h:459:11: note: declared here
  459 |     using invoke = typename Fn::template invoke<Args...>;
      |           ^~~~~~
make[3]: *** [CMakeFiles/clang-unformat.dir/build.make:76: CMakeFiles/clang-unformat.dir/standalone/application.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:1199: CMakeFiles/clang-unformat.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1206: CMakeFiles/clang-unformat.dir/rule] Error 2
make: *** [Makefile:169: clang-unformat] Error 2
lmb commented 7 months ago

The following patch makes the program compile for me:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba6c324..b484321 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,8 @@ if (NOT edlib_FOUND)
     endif()
 endif()

+add_compile_options(-Wno-changes-meaning)
+
 #######################################################
 ### Executable                                      ###
 #######################################################

Most likely this is a new heuristic:

$ clang --version
clang version 17.0.6 (Fedora 17.0.6-1.fc39)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Maritsu commented 7 months ago

The following patch makes the program compile for me:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ba6c324..b484321 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,6 +53,8 @@ if (NOT edlib_FOUND)
     endif()
 endif()

+add_compile_options(-Wno-changes-meaning)
+
 #######################################################
 ### Executable                                      ###
 #######################################################

Most likely this is a new heuristic:

$ clang --version
clang version 17.0.6 (Fedora 17.0.6-1.fc39)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

@lmb thank you for the patch! i got a different compilation error this time, but at least this one is resolved.