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

Compilation fails on Windows 11 #14

Open k-Knight opened 1 year ago

k-Knight commented 1 year ago
C:\Users\k-Knight\Git\clang-unformat\standalone\cli_config.cpp:147:19:   required from here
C:/Users/k-Knight/Git/clang-unformat/build/_deps/fmt-src/include/fmt/core.h:1451:54: error: 'constexpr bool fmt::v8::detail::has_const_formatter() [with T = std::filesystem::__cxx11::path; Context = fmt::v8::basic_format_context<fmt::v8::appender, char>]' called in a constant expression before its definition is complete
 1451 |       : bool_constant<has_const_formatter<U, Context>() ||
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
C:/Users/k-Knight/Git/clang-unformat/build/_deps/fmt-src/include/fmt/core.h:1452:68: note: in template argument for type 'bool'
 1451 |       : bool_constant<has_const_formatter<U, Context>() ||
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1452 |                       !std::is_const<remove_reference_t<T>>::value ||
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
 1453 |                       has_fallback_formatter<U, char_type>::value> {};
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mingw32-make[3]: *** [CMakeFiles\clang-unformat.dir\build.make:106: CMakeFiles/clang-unformat.dir/standalone/cli_config.cpp.obj] Error 1
mingw32-make[2]: *** [CMakeFiles\Makefile2:1216: CMakeFiles/clang-unformat.dir/all] Error 2
mingw32-make[1]: *** [CMakeFiles\Makefile2:1223: CMakeFiles/clang-unformat.dir/rule] Error 2
mingw32-make: *** [Makefile:168: clang-unformat] Error 2
gfgit commented 1 year ago

Same issue:

clang-unformat\standalone\cli_config.cpp:147: error: 'constexpr bool fmt::v8::detail::has_const_formatter() [with T = std::filesystem::__cxx11::path; Context = fmt::v8::basic_format_context<fmt::v8::appender, char>]' called in a constant expression before its definition is complete
clang-unformat/build/_deps/fmt-src/include/fmt/core.h:1855:71:   required from 'constexpr fmt::v8::format_arg_store<Context, Args>::format_arg_store(T&& ...) [with T = {std::filesystem::__cxx11::path&}; Context = fmt::v8::basic_format_context<fmt::v8::appender, char>; Args = {std::filesystem::__cxx11::path}]'
clang-unformat/build/_deps/fmt-src/include/fmt/core.h:1872:38:   required from 'constexpr fmt::v8::format_arg_store<Context, typename std::remove_cv<typename std::remove_reference<Args>::type>::type ...> fmt::v8::make_format_args(Args&& ...) [with Context = basic_format_context<appender, char>; Args = {std::filesystem::__cxx11::path&}]'
clang-unformat/build/_deps/fmt-src/include/fmt/core.h:3207:44:   required from 'void fmt::v8::print(format_string<T ...>, T&& ...) [with T = {std::filesystem::__cxx11::path&}; format_string<T ...> = basic_format_string<char, std::filesystem::__cxx11::path&>]'
clang-unformat/standalone/cli_config.cpp:147:19:   required from here
clang-unformat/build/_deps/fmt-src/include/fmt/core.h:1451:54: error: 'constexpr bool fmt::v8::detail::has_const_formatter() [with T = std::filesystem::__cxx11::path; Context = fmt::v8::basic_format_context<fmt::v8::appender, char>]' called in a constant expression before its definition is complete
 1451 |       : bool_constant<has_const_formatter<U, Context>() ||
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
clang-unformat/build/_deps/fmt-src/include/fmt/core.h:1452:68: note: in template argument for type 'bool'
 1451 |       : bool_constant<has_const_formatter<U, Context>() ||
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1452 |                       !std::is_const<remove_reference_t<T>>::value ||
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
 1453 |                       has_fallback_formatter<U, char_type>::value> {};
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

OS: Windows 10 64-bit Compiler: MinGW-W64 12.2.0

Is this library fault or clang-unformat error?

gfgit commented 1 year ago

@k-Knight If you need it working soon, I've made a temp fix. 0001-Temp-fix-make-it-compile-on-Windows-10.patch 0002-Fix-linking-with-MinGW-W64-12.2.0.patch

The second one is only needed if you compile with MinGW