Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

Intel c++ compiler error with pybind11 using -std=c++17

Soprana__Arthur
Beginner
1,997 Views
Hello,
 
I am getting a compile error when using the Intel c++ compiler (ICC - 19.0.0.046 20180317) when compiling a simple code, basically importing pybind11 with the option -std=c++17. The error log is very large, but starts as follows
In file included from /home/soprano/work/pybind11/include/pybind11/cast.h(16),
                 from /home/soprano/work/pybind11/include/pybind11/attr.h(13),
                 from /home/soprano/work/pybind11/include/pybind11/pybind11.h(43),
                 from test.cpp(1):
/home/soprano/work/pybind11/include/pybind11/detail/internals.h(175): error: a constexpr function cannot have a parameter of nonliteral type "std::__exception_ptr::exception_ptr"
              [](std::exception_ptr p) -> void {
                ^

/home/soprano/work/pybind11/include/pybind11/cast.h(2078): error: no instance of overloaded function "pybind11::detail::collect_arguments" matches the argument list
            argument types are: (const char *const)
      return detail::collect_arguments<policy>(std::forward<Args>(args)...).call(derived().ptr());
             ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2064): note: this candidate was rejected because at least one template argument could not be deduced
  unpacking_collector<policy> collect_arguments(Args &&...args) {
                              ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2057): note: this candidate was rejected because at least one template argument could not be deduced
  simple_collector<policy> collect_arguments(Args &&...args) {
                           ^
          detected during:

The command line call was

icpc -std=c++17 test.cpp -I/pybind11/include/path -I/python/include/path
 
However, if I change the option to -std=c++14 or c++11, it works fine. g++ also compiles with no problems when using the c++17 option. It seems like a compiler bug. The code used is presented below.
// test.cpp
#include <pybind11/pybind11.h>

int main(){
    return 0;
}

Does anyone have any idea of what this might be?

Best regards,

Arthur Besen Soprana

0 Kudos
10 Replies
JenniferJ
Moderator
1,997 Views

I think this issue has been fixed. Please wait for 19.0 beta update. it should be available soon. Please check back on the beta thread. It should be updated when the beta update is available.

Jennifer 

0 Kudos
Soprana__Arthur
Beginner
1,997 Views

I've just tryed the update 1 for the beta release (icpc (ICC) 19.0.0.070 20180524) and now got different errors:

 

icpc -std=c++17 test.cpp -I/home/soprano/work/pybind11/include -I/home/soprano/miniconda3/include/python3.6m
/home/soprano/work/pybind11/include/pybind11/cast.h(2078): error: no instance of overloaded function "pybind11::detail::collect_arguments" matches the argument list
            argument types are: (const char *const)
      return detail::collect_arguments<policy>(std::forward<Args>(args)...).call(derived().ptr());
             ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2064): note: this candidate was rejected because at least one template argument could not be deduced
  unpacking_collector<policy> collect_arguments(Args &&...args) {
                              ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2057): note: this candidate was rejected because at least one template argument could not be deduced
  simple_collector<policy> collect_arguments(Args &&...args) {
                           ^
          detected during:
            instantiation of "pybind11::object pybind11::detail::object_api<Derived>::operator()(Args &&...) const [with Derived=pybind11::detail::accessor<pybind11::detail::accessor_policies::str_attr>, policy=pybind11::return_value_policy::automatic_reference, Args=<const char *const &>]" at line 1322 of "/home/soprano/work/pybind11/include/pybind11/pytypes.h"
            instantiation of "bool pybind11::detail::object_api<Derived>::contains(T &&) const [with Derived=pybind11::handle, T=const char *const &]" at line 143 of "/home/soprano/work/pybind11/include/pybind11/detail/internals.h"

/home/soprano/work/pybind11/include/pybind11/cast.h(2078): error: no instance of overloaded function "pybind11::detail::collect_arguments" matches the argument list
      return detail::collect_arguments<policy>(std::forward<Args>(args)...).call(derived().ptr());
             ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2064): note: this candidate was rejected because at least one template argument could not be deduced
  unpacking_collector<policy> collect_arguments(Args &&...args) {
                              ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2057): note: this candidate was rejected because at least one template argument could not be deduced
  simple_collector<policy> collect_arguments(Args &&...args) {
                           ^
          detected during instantiation of "pybind11::object pybind11::detail::object_api<Derived>::operator()(Args &&...) const [with Derived=pybind11::detail::accessor<pybind11::detail::accessor_policies::str_attr>, policy=pybind11::return_value_policy::automatic_reference, Args=<>]" at line 200 of "/home/soprano/work/pybind11/include/pybind11/pybind11.h"

/home/soprano/work/pybind11/include/pybind11/cast.h(2078): error: no instance of overloaded function "pybind11::detail::collect_arguments" matches the argument list
            argument types are: (pybind11::handle, pybind11::handle)
      return detail::collect_arguments<policy>(std::forward<Args>(args)...).call(derived().ptr());
             ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2064): note: this candidate was rejected because at least one template argument could not be deduced
  unpacking_collector<policy> collect_arguments(Args &&...args) {
                              ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2057): note: this candidate was rejected because at least one template argument could not be deduced
  simple_collector<policy> collect_arguments(Args &&...args) {
                           ^
          detected during:
            instantiation of "pybind11::object pybind11::detail::object_api<Derived>::operator()(Args &&...) const [with Derived=pybind11::detail::accessor<pybind11::detail::accessor_policies::str_attr>, policy=pybind11::return_value_policy::automatic_reference, Args=<pybind11::handle &, pybind11::handle &>]" at line 881 of "/home/soprano/work/pybind11/include/pybind11/pytypes.h"
            instantiation of "pybind11::str pybind11::str::format(Args &&...) const [with Args=<pybind11::handle &, pybind11::handle &>]" at line 749 of "/home/soprano/work/pybind11/include/pybind11/pybind11.h"

/home/soprano/work/pybind11/include/pybind11/cast.h(2078): error: no instance of overloaded function "pybind11::detail::collect_arguments" matches the argument list
            argument types are: (pybind11::handle, pybind11::handle, pybind11::none, pybind11::str)
      return detail::collect_arguments<policy>(std::forward<Args>(args)...).call(derived().ptr());
             ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2064): note: this candidate was rejected because at least one template argument could not be deduced
  unpacking_collector<policy> collect_arguments(Args &&...args) {
                              ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2057): note: this candidate was rejected because at least one template argument could not be deduced
  simple_collector<policy> collect_arguments(Args &&...args) {
                           ^
          detected during instantiation of "pybind11::object pybind11::detail::object_api<Derived>::operator()(Args &&...) const [with Derived=pybind11::handle, policy=pybind11::return_value_policy::automatic_reference, Args=<pybind11::handle, pybind11::handle, pybind11::none, pybind11::str>]" at line 964 of "/home/soprano/work/pybind11/include/pybind11/pybind11.h"

/home/soprano/work/pybind11/include/pybind11/cast.h(2078): error: no instance of overloaded function "pybind11::detail::collect_arguments" matches the argument list
            argument types are: (pybind11::tuple)
      return detail::collect_arguments<policy>(std::forward<Args>(args)...).call(derived().ptr());
             ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2064): note: this candidate was rejected because at least one template argument could not be deduced
  unpacking_collector<policy> collect_arguments(Args &&...args) {
                              ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2057): note: this candidate was rejected because at least one template argument could not be deduced
  simple_collector<policy> collect_arguments(Args &&...args) {
                           ^
          detected during instantiation of "pybind11::object pybind11::detail::object_api<Derived>::operator()(Args &&...) const [with Derived=pybind11::detail::accessor<pybind11::detail::accessor_policies::str_attr>, policy=pybind11::return_value_policy::automatic_reference, Args=<pybind11::tuple &>]" at line 1717 of "/home/soprano/work/pybind11/include/pybind11/pybind11.h"

/home/soprano/work/pybind11/include/pybind11/cast.h(2078): error: no instance of overloaded function "pybind11::detail::collect_arguments" matches the argument list
            argument types are: (pybind11::object)
      return detail::collect_arguments<policy>(std::forward<Args>(args)...).call(derived().ptr());
             ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2064): note: this candidate was rejected because at least one template argument could not be deduced
  unpacking_collector<policy> collect_arguments(Args &&...args) {
                              ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2057): note: this candidate was rejected because at least one template argument could not be deduced
  simple_collector<policy> collect_arguments(Args &&...args) {
                           ^
          detected during instantiation of "pybind11::object pybind11::detail::object_api<Derived>::operator()(Args &&...) const [with Derived=pybind11::detail::accessor<pybind11::detail::accessor_policies::str_attr>, policy=pybind11::return_value_policy::automatic_reference, Args=<pybind11::object &>]" at line 1735 of "/home/soprano/work/pybind11/include/pybind11/pybind11.h"

/home/soprano/work/pybind11/include/pybind11/cast.h(2078): error: no instance of overloaded function "pybind11::detail::collect_arguments" matches the argument list
            argument types are: (pybind11::object)
      return detail::collect_arguments<policy>(std::forward<Args>(args)...).call(derived().ptr());
             ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2064): note: this candidate was rejected because at least one template argument could not be deduced
  unpacking_collector<policy> collect_arguments(Args &&...args) {
                              ^
/home/soprano/work/pybind11/include/pybind11/cast.h(2057): note: this candidate was rejected because at least one template argument could not be deduced
  simple_collector<policy> collect_arguments(Args &&...args) {
                           ^
          detected during instantiation of "pybind11::object pybind11::detail::object_api<Derived>::operator()(Args &&...) const [with Derived=pybind11::detail::accessor<pybind11::detail::accessor_policies::str_attr>, policy=pybind11::return_value_policy::automatic_reference, Args=<pybind11::object>]" at line 1736 of "/home/soprano/work/pybind11/include/pybind11/pybind11.h"

compilation aborted for test.cpp (code 2)

 

0 Kudos
Viet_H_Intel
Moderator
1,997 Views

 

Can you please create a preprocess file for us? 

$icpc test.cpp -E -std=c++17-I/home/soprano/work/pybind11/include -I/home/soprano/miniconda3/include/python3.6m

Thanks,

Viet

0 Kudos
Soprana__Arthur
Beginner
1,997 Views

Sure, here it goes (see attached file).

Arthur

 

0 Kudos
pfahler__lukas
Beginner
1,997 Views

Any updates on this one?

0 Kudos
Viet_H_Intel
Moderator
1,997 Views

Have you tried 19.0 Update 5?

0 Kudos
Soprana__Arthur
Beginner
1,997 Views

No sorry. My intel license has expired and therefore I am not able to check if it works on this version.

The error still persists.

0 Kudos
Viet_H_Intel
Moderator
1,997 Views

For some reasons, I couldn't be able to download your preprocessed file. Can you upload it again.

0 Kudos
Soprana__Arthur
Beginner
1,997 Views

Here it goes

0 Kudos
Viet_H_Intel
Moderator
1,997 Views

Thanks for the preprocessed file. I've reported to our Developer. Internal tracking number is "CMPLRIL0-32248"

0 Kudos
Reply