mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-22 21:25:13 +00:00
Add MSVC 2017 cpp_function ICE workaround
The `decltype(...)` in the template parameter that gives us SFINAE matching for a lambda makes MSVC 2017 ICE; this works around if by changing the test to an explicit not-a-function-or-pointer test, which seems to work everywhere.
This commit is contained in:
parent
b7017c3dad
commit
2d965d43a6
@ -51,9 +51,14 @@ public:
|
||||
}
|
||||
|
||||
/// Construct a cpp_function from a lambda function (possibly with internal state)
|
||||
template <typename Func, typename... Extra,
|
||||
typename FuncType = typename detail::remove_class<decltype(&std::remove_reference<Func>::type::operator())>::type>
|
||||
template <typename Func, typename... Extra, typename = detail::enable_if_t<
|
||||
detail::satisfies_none_of<
|
||||
typename std::remove_reference<Func>::type,
|
||||
std::is_function, std::is_pointer, std::is_member_pointer
|
||||
>::value>
|
||||
>
|
||||
cpp_function(Func &&f, const Extra&... extra) {
|
||||
using FuncType = typename detail::remove_class<decltype(&std::remove_reference<Func>::type::operator())>::type;
|
||||
initialize(std::forward<Func>(f),
|
||||
(FuncType *) nullptr, extra...);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user