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:
Jason Rhinelander 2017-03-12 13:34:30 -03:00
parent b7017c3dad
commit 2d965d43a6

View File

@ -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...);
}