@@ -508,10 +508,6 @@ POLICY: For non-variadic implementations, the number of arguments is limited
508
508
509
509
#include < __functional_base>
510
510
511
- #if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC)
512
- #include < Block.h>
513
- #endif
514
-
515
511
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
516
512
#pragma GCC system_header
517
513
#endif
@@ -2257,6 +2253,9 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>
2257
2253
2258
2254
#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC)
2259
2255
2256
+ extern " C" void *_Block_copy (const void *);
2257
+ extern " C" void _Block_release (const void *);
2258
+
2260
2259
template <class _Rp1 , class ..._ArgTypes1, class _Alloc , class _Rp , class ..._ArgTypes>
2261
2260
class __func <_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
2262
2261
: public __base<_Rp(_ArgTypes...)>
@@ -2267,14 +2266,14 @@ class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
2267
2266
public:
2268
2267
_LIBCPP_INLINE_VISIBILITY
2269
2268
explicit __func (__block_type const & __f)
2270
- : __f_(__f ? Block_copy (__f) : (__block_type)0 )
2269
+ : __f_(reinterpret_cast <__block_type>( __f ? _Block_copy (__f) : nullptr) )
2271
2270
{ }
2272
2271
2273
2272
// [TODO] add && to save on a retain
2274
2273
2275
2274
_LIBCPP_INLINE_VISIBILITY
2276
2275
explicit __func (__block_type __f, const _Alloc& /* unused */ )
2277
- : __f_(__f ? Block_copy (__f) : (__block_type)0 )
2276
+ : __f_(reinterpret_cast <__block_type>( __f ? _Block_copy (__f) : nullptr) )
2278
2277
{ }
2279
2278
2280
2279
virtual __base<_Rp(_ArgTypes...)>* __clone () const {
@@ -2291,7 +2290,7 @@ public:
2291
2290
2292
2291
virtual void destroy () _NOEXCEPT {
2293
2292
if (__f_)
2294
- Block_release (__f_);
2293
+ _Block_release (__f_);
2295
2294
__f_ = 0 ;
2296
2295
}
2297
2296
0 commit comments