[libcxx] r276090 - Move std::function constructor SFINAE into template parameter list. Fixes PR20002.

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 19 22:21:00 PDT 2016


Author: ericwf
Date: Wed Jul 20 00:21:00 2016
New Revision: 276090

URL: http://llvm.org/viewvc/llvm-project?rev=276090&view=rev
Log:
Move std::function constructor SFINAE into template parameter list. Fixes PR20002.

Although inheriting constructors have already been fixed in Clang 3.9 I still
choose to fix std::function so users can derive from it with older compilers.

Modified:
    libcxx/trunk/include/functional

Modified: libcxx/trunk/include/functional
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/functional?rev=276090&r1=276089&r2=276090&view=diff
==============================================================================
--- libcxx/trunk/include/functional (original)
+++ libcxx/trunk/include/functional Wed Jul 20 00:21:00 2016
@@ -1595,12 +1595,10 @@ public:
     function(nullptr_t) _NOEXCEPT : __f_(0) {}
     function(const function&);
     function(function&&) _NOEXCEPT;
-    template<class _Fp>
-      function(_Fp, typename enable_if
-                                     <
-                                        __callable<_Fp>::value &&
-                                        !is_same<_Fp, function>::value
-                                      >::type* = 0);
+    template<class _Fp, class = typename enable_if<
+        __callable<_Fp>::value && !is_same<_Fp, function>::value
+    >::type>
+    function(_Fp);
 
     template<class _Alloc>
       _LIBCPP_INLINE_VISIBILITY
@@ -1612,9 +1610,8 @@ public:
       function(allocator_arg_t, const _Alloc&, const function&);
     template<class _Alloc>
       function(allocator_arg_t, const _Alloc&, function&&);
-    template<class _Fp, class _Alloc>
-      function(allocator_arg_t, const _Alloc& __a, _Fp __f,
-               typename enable_if<__callable<_Fp>::value>::type* = 0);
+    template<class _Fp, class _Alloc, class = typename enable_if<__callable<_Fp>::value>::type>
+      function(allocator_arg_t, const _Alloc& __a, _Fp __f);
 
     function& operator=(const function&);
     function& operator=(function&&) _NOEXCEPT;
@@ -1728,13 +1725,8 @@ function<_Rp(_ArgTypes...)>::function(al
 }
 
 template<class _Rp, class ..._ArgTypes>
-template <class _Fp>
-function<_Rp(_ArgTypes...)>::function(_Fp __f,
-                                     typename enable_if
-                                     <
-                                        __callable<_Fp>::value &&
-                                        !is_same<_Fp, function>::value
-                                     >::type*)
+template <class _Fp, class>
+function<_Rp(_ArgTypes...)>::function(_Fp __f)
     : __f_(0)
 {
     if (__function::__not_null(__f))
@@ -1757,9 +1749,8 @@ function<_Rp(_ArgTypes...)>::function(_F
 }
 
 template<class _Rp, class ..._ArgTypes>
-template <class _Fp, class _Alloc>
-function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
-                                     typename enable_if<__callable<_Fp>::value>::type*)
+template <class _Fp, class _Alloc, class>
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f)
     : __f_(0)
 {
     typedef allocator_traits<_Alloc> __alloc_traits;




More information about the cfe-commits mailing list