mirror of
https://github.com/pybind/pybind11.git
synced 2025-02-16 21:57:55 +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)
|
/// Construct a cpp_function from a lambda function (possibly with internal state)
|
||||||
template <typename Func, typename... Extra,
|
template <typename Func, typename... Extra, typename = detail::enable_if_t<
|
||||||
typename FuncType = typename detail::remove_class<decltype(&std::remove_reference<Func>::type::operator())>::type>
|
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) {
|
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),
|
initialize(std::forward<Func>(f),
|
||||||
(FuncType *) nullptr, extra...);
|
(FuncType *) nullptr, extra...);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user