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

ICC 19.1 cannot deduce template argument #2899

Closed
spyridon97 opened this issue May 17, 2022 · 3 comments
Closed

ICC 19.1 cannot deduce template argument #2899

spyridon97 opened this issue May 17, 2022 · 3 comments

Comments

@spyridon97
Copy link

On ParaView we originally used to have the following issue https://gitlab.kitware.com/paraview/paraview/-/issues/21374 with ICC 19.1 which was fixed by #2746. Now, we have a new issue that again exists only on ICC 19.1. I have tried with gcc 9, 11, vs2019, xcode 13.1 and even icc 21, and i have no issues.

/tmp/stam/spack-stage/spack-stage-paraview-master-qzzffti6r57m6uufg4ddfvl542kg75y4/spack-src/VTK/ThirdParty/fmt/vtkfmt/vtkfmt/core.h(1286): error: no instance of function template "vtkfmt::v8::formatter<T, Char, vtkfmt::v8::enable_if_t<<expression>, void>>::format [with T=std::vector<double, std::allocator<double>>, Char=char]" matches the argument list
            argument types are: (qualified_type, vtkfmt::v8::format_context)
            object type is: vtkfmt::v8::conditional_t<true, vtkfmt::v8::formatter<std::vector<double, std::allocator<double>>, char, void>, vtkfmt::v8::detail::fallback_formatter<std::vector<double, std::allocator<double>>, char, void>>
      ctx.advance_to(f.format(*static_cast<qualified_type*>(arg), ctx));
                       ^
/tmp/stam/spack-stage/spack-stage-paraview-master-qzzffti6r57m6uufg4ddfvl542kg75y4/spack-src/VTK/ThirdParty/fmt/vtkfmt/vtkfmt/ranges.h(606): note: this candidate was rejected because at least one template argument could not be deduced
    auto format(U& range, FormatContext& ctx) -> decltype(ctx.out()) {
         ^
          detected during:
            instantiation of "void vtkfmt::v8::detail::value<Context>::format_custom_arg<T,Formatter>(void *, Context::parse_context_type &, Context &) [with Context=vtkfmt::v8::format_context, T=vtkfmt::v8::remove_cvref_t<const std::vector<double, std::allocator<double>>>, Formatter=vtkfmt::v8::conditional_t<true, vtkfmt::v8::formatter<std::vector<double, std::allocator<double>>, char, void>, vtkfmt::v8::detail::fallback_formatter<std::vector<double, std::allocator<double>>, char, void>>]" at
                      line 1269
            instantiation of "vtkfmt::v8::detail::value<Context>::value(T &) [with Context=vtkfmt::v8::format_context, T=const std::vector<double, std::allocator<double>>]" at line 1700
            instantiation of "auto vtkfmt::v8::detail::make_arg<Context,T>(const T &)->vtkfmt::v8::basic_format_arg<Context> [with Context=vtkfmt::v8::format_context, T=std::vector<double, std::allocator<double>>]" at line 134 of "/tmp/stam/spack-stage/spack-stage-paraview-master-qzzffti6r57m6uufg4ddfvl542kg75y4/spack-src/VTK/ThirdParty/fmt/vtkfmt/vtkfmt/args.h"
            instantiation of "void vtkfmt::v8::dynamic_format_arg_store<Context>::emplace_arg(const vtkfmt::v8::detail::named_arg<vtkfmt::v8::dynamic_format_arg_store<Context>::char_type, T> &) [with Context=vtkfmt::v8::format_context, T=std::vector<double, std::allocator<double>>]" at line 205 of "/tmp/stam/spack-stage/spack-stage-paraview-master-qzzffti6r57m6uufg4ddfvl542kg75y4/spack-src/VTK/ThirdParty/fmt/vtkfmt/vtkfmt/args.h"
            instantiation of "void vtkfmt::v8::dynamic_format_arg_store<Context>::push_back(const vtkfmt::v8::detail::named_arg<vtkfmt::v8::dynamic_format_arg_store<Context>::char_type, T> &) [with Context=vtkfmt::v8::format_context, T=std::vector<double, std::allocator<double>>]" at line 491 of "/tmp/stam/spack-stage/spack-stage-paraview-master-qzzffti6r57m6uufg4ddfvl542kg75y4/spack-src/VTKExtensions/Core/vtkPVStringFormatter.h"

compilation aborted for /tmp/stam/spack-stage/spack-stage-paraview-master-qzzffti6r57m6uufg4ddfvl542kg75y4/spack-src/VTKExtensions/Core/vtkPVStringFormatter.cxx (code 2)
make[2]: *** [VTKExtensions/Core/CMakeFiles/VTKExtensionsCore-objects.dir/vtkPVStringFormatter.cxx.o] Error 2
make[2]: *** Waiting for unfinished jobs....

In my understanding the issue is that std::vector<double> can't be pushed as an argument to a dynamic_format_arg_store even when fmt/ranges.h is included.

The files in which the issue occurs are https://gitlab.kitware.com/paraview/paraview/-/blob/master/VTKExtensions/Core/vtkPVStringFormatter.h,
https://gitlab.kitware.com/paraview/paraview/-/blob/master/VTKExtensions/Core/vtkPVStringFormatter.cxx

Any help would be more than welcome!

@vitaut
Copy link
Contributor

vitaut commented May 17, 2022

Could you provide a self-contained godbolt repro? (I wasn't able to repro in https://godbolt.org/z/cj9WaoaKb.)

@vitaut
Copy link
Contributor

vitaut commented May 27, 2022

Closing as it looks like an ICC 19.1 bug but a PR with a workaround would be welcome.

@vitaut vitaut closed this as completed May 27, 2022
@spyridon97
Copy link
Author

spyridon97 commented Jun 1, 2022

As it seems, i managed to reproduce this error by getting my hands on an icc compiler 19.1.3.

And trying to compile fmt and its tests:

/home/tplfmt/test/core-test.cc(796): error: static assertion failed with ""
    static_assert(!fmt::is_formattable<const nonconst_formattable&>::value, "");
    ^

/home/tplfmt/include/fmt/format.h(2339): warning #4041: constexpr if statements are a C++17 feature
      if constexpr (std::numeric_limits<double>::is_iec559) {
         ^
          detected during:
            instantiation of "auto fmt::v8::detail::write(OutputIt, T, fmt::v8::basic_format_specs<Char>, fmt::v8::detail::locale_ref)->OutputIt [with Char=char, OutputIt=fmt::v8::detail::buffer_appender<char>, T=float, <unnamed>=0]" at line 2403
            instantiation of "auto fmt::v8::detail::write<Char,OutputIt,T,<unnamed>>(OutputIt, T)->OutputIt [with Char=char, OutputIt=fmt::v8::detail::buffer_appender<char>, T=float, <unnamed>=0]" at line 2559
            instantiation of "auto fmt::v8::detail::default_arg_formatter<Char>::operator()(T)->fmt::v8::detail::default_arg_formatter<Char>::iterator [with Char=char, T=float]" at line 1617 of "/home/tplfmt/include/fmt/core.h"
            instantiation of "auto fmt::v8::visit_format_arg(Visitor &&, const fmt::v8::basic_format_arg<Context> &)->decltype((<expression>)) [with Visitor=fmt::v8::detail::default_arg_formatter<char>, Context=fmt::v8::format_context]" at line 3266
            instantiation of "void fmt::v8::detail::vformat_to(fmt::v8::detail::buffer<Char> &, fmt::v8::basic_string_view<Char>, fmt::v8::basic_format_args<fmt::v8::basic_format_context<fmt::v8::detail::buffer_appender<fmt::v8::type_identity_t<Char>>, fmt::v8::type_identity_t<Char>>>, fmt::v8::detail::locale_ref) [with Char=char]" at line 3176 of "/home/tplfmt/include/fmt/core.h"
            [ 12 instantiation contexts not shown ]
            instantiation of "auto fmt::v8::detail::make_value<Context,T>(T &&)->fmt::v8::detail::value<Context> [with Context=fmt::v8::format_context, T=int (&)[6]]" at line 1744 of "/home/tplfmt/include/fmt/core.h"
            instantiation of "auto fmt::v8::detail::make_arg<IS_PACKED,Context,<unnamed>,T,<unnamed>>(T &&)->fmt::v8::detail::value<Context> [with IS_PACKED=true, Context=fmt::v8::format_context, <unnamed>=fmt::v8::detail::type::custom_type, T=int (&)[6], <unnamed>=0]" at line 1869 of "/home/tplfmt/include/fmt/core.h"
            instantiation of "fmt::v8::format_arg_store<Context, Args...>::format_arg_store(T &&...) [with Context=fmt::v8::format_context, Args=<int [6]>, T=<int (&)[6]>]" at line 1885 of "/home/tplfmt/include/fmt/core.h"
            instantiation of "auto fmt::v8::make_format_args(Args &&...)->fmt::v8::format_arg_store<Context, fmt::v8::remove_cvref_t<Args>...> [with Context=fmt::v8::format_context, Args=<int (&)[6]>]" at line 3167 of "/home/tplfmt/include/fmt/core.h"
            instantiation of "auto fmt::v8::format(fmt::v8::format_string<T...>, T &&...)->std::__cxx11::string [with T=<int (&)[6]>]" at line 32 of "/home/tplfmt/test/ranges-test.cc"

/home/tplfmt/include/fmt/core.h(1266): error: no instance of function template "fmt::v8::formatter<T, Char, fmt::v8::enable_if_t<<expression>, void>>::format [with T=std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>, std::allocator<std::pair<const std::__cxx11::string, int>>>, Char=char]" matches the argument list
            argument types are: (qualified_type, fmt::v8::format_context)
            object type is: fmt::v8::conditional_t<true, fmt::v8::formatter<std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>, std::allocator<std::pair<const std::__cxx11::string, int>>>, char, void>, fmt::v8::detail::fallback_formatter<fmt::v8::remove_cvref_t<const std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>, std::allocator<std::pair<const std::__cxx11::string, int>>>>, char, void>>
      ctx.advance_to(f.format(*static_cast<qualified_type*>(arg), ctx));
                       ^
/home/tplfmt/include/fmt/ranges.h(443): note: this candidate was rejected because at least one template argument could not be deduced
    auto format(U& map, FormatContext& ctx) const -> decltype(ctx.out()) {
         ^
          detected during:
            instantiation of "void fmt::v8::detail::value<Context>::format_custom_arg<T,Formatter>(void *, Context::parse_context_type &, Context &) [with Context=fmt::v8::format_context, T=fmt::v8::remove_cvref_t<const std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>, std::allocator<std::pair<const std::__cxx11::string, int>>>>, Formatter=fmt::v8::conditional_t<true, fmt::v8::formatter<std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>,
                      std::allocator<std::pair<const std::__cxx11::string, int>>>, char, void>, fmt::v8::detail::fallback_formatter<fmt::v8::remove_cvref_t<const std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>, std::allocator<std::pair<const std::__cxx11::string, int>>>>, char, void>>]" at line 1249
            instantiation of "fmt::v8::detail::value<Context>::value(T &) [with Context=fmt::v8::format_context, T=const std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>, std::allocator<std::pair<const std::__cxx11::string, int>>>]" at line 1727
            instantiation of "auto fmt::v8::detail::make_value<Context,T>(T &&)->fmt::v8::detail::value<Context> [with Context=fmt::v8::format_context, T=std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>, std::allocator<std::pair<const std::__cxx11::string, int>>> &]" at line 1744
            instantiation of "auto fmt::v8::detail::make_arg<IS_PACKED,Context,<unnamed>,T,<unnamed>>(T &&)->fmt::v8::detail::value<Context> [with IS_PACKED=true, Context=fmt::v8::format_context, <unnamed>=fmt::v8::detail::type::custom_type, T=std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>, std::allocator<std::pair<const std::__cxx11::string, int>>> &, <unnamed>=0]" at line 1869
            instantiation of "fmt::v8::format_arg_store<Context, Args...>::format_arg_store(T &&...) [with Context=fmt::v8::format_context, Args=<std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>, std::allocator<std::pair<const std::__cxx11::string, int>>>>, T=<std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>, std::allocator<std::pair<const std::__cxx11::string, int>>> &>]" at line 1885
            instantiation of "auto fmt::v8::make_format_args(Args &&...)->fmt::v8::format_arg_store<Context, fmt::v8::remove_cvref_t<Args>...> [with Context=fmt::v8::format_context, Args=<std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>, std::allocator<std::pair<const std::__cxx11::string, int>>> &>]" at line 3167
            instantiation of "auto fmt::v8::format(fmt::v8::format_string<T...>, T &&...)->std::__cxx11::string [with T=<std::map<std::__cxx11::string, int, std::less<std::__cxx11::string>, std::allocator<std::pair<const std::__cxx11::string, int>>> &>]" at line 60 of "/home/tplfmt/test/ranges-test.cc"

As you can see the ranges tests fail compiling. But sadly i can't find an online icc 19.1.3 so that you can also reproduce it.

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