Prevent ill-formed instantiation of __invoke_of<...> during the evaluation of a bind expression. Fixes PR22003.
The SFINAE on the function __mu(Fn, Args...) that evaluates nested bind
expressions always tries to deduce the return type for Fn(Args...) even when Fn
is not a nested bind expression. This can cause hard compile errors when the
instantation of Fn(Args...) is ill-formed. This patch prevents the instantation
of __invoke_of<Fn, Args...> unless Fn is actually a bind expression.
Bug reportand patch from Michel Morin.
http://llvm.org/bugs/show_bug.cgi?id=22003
llvm-svn: 224753
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 279663c1b4bfcec7f849dd2becf207841c45c0cf
diff --git a/include/functional b/include/functional
index 416a9a9..d14b46b 100644
--- a/include/functional
+++ b/include/functional
@@ -1863,10 +1863,10 @@
template <class _Ti, class ..._Uj>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
+typename __lazy_enable_if
<
is_bind_expression<_Ti>::value,
- typename __invoke_of<_Ti&, _Uj...>::type
+ __invoke_of<_Ti&, _Uj...>
>::type
__mu(_Ti& __ti, tuple<_Uj...>& __uj)
{