Skip to content

[BUG] ICC cannot compile master and current release due to ICC's bug #2707

Closed
@gnaggnoyil

Description

@gnaggnoyil

Issue description

Due to an ICC bug, current usage of pybind11::detail::all_of in SFINAE-context will be rejected by ICC.

When compiling the code below using linux64 icc, the following error message will be omitted:

$ icpc -o test -std=c++17 -isystem $PYBIND11_ROOT/include -isystem /usr/include/python3.8 test.cpp
test.cpp(17): error: no instance of function template "foo" matches the argument list
            argument types are: (const char *)
        foo(x);
        ^
test.cpp(11): note: this candidate was rejected because at least one template argument could not be deduced
  void foo(Args &&...){
       ^

compilation aborted for test.cpp (code 2)

Tested with current master and latest release(2.6.0) and the problem exists.

This problem blocks usage of object_api<Derived>::operator() in cast.h, which eventually makes it unable to use expressions such as .def(pybind11::init<T...>(pybind11::arg("foo")...).

Reproducible example code

#include <iostream>
#include <type_traits>

#include <pybind11/pytypes.h>

using namespace pybind11;
using namespace pybind11::detail;

template <typename ...Args,
        typename = std::enable_if_t<all_of<is_positional<Args>...>::value>>
void foo(Args &&...){
        std::cout << "bbb" << std::endl;
}

int main(){
        const char *x = "aaa";
        foo(x);
        return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions