[cfe-commits] [libcxx] r156182 - /libcxx/trunk/include/functional

Howard Hinnant hhinnant at apple.com
Fri May 4 10:21:02 PDT 2012


Author: hhinnant
Date: Fri May  4 12:21:02 2012
New Revision: 156182

URL: http://llvm.org/viewvc/llvm-project?rev=156182&view=rev
Log:
Constrain __bind functor constructor such that it won't accidentally get used as a copy constructor from a non-const lvalue.  Fixes <rdar://problem/11359080>.

Modified:
    libcxx/trunk/include/functional

Modified: libcxx/trunk/include/functional
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/functional?rev=156182&r1=156181&r2=156182&view=diff
==============================================================================
--- libcxx/trunk/include/functional (original)
+++ libcxx/trunk/include/functional Fri May  4 12:21:02 2012
@@ -1707,7 +1707,11 @@
 
 #endif  // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
 
-    template <class _Gp, class ..._BA>
+    template <class _Gp, class ..._BA,
+              class = typename enable_if
+                               <
+                                  is_constructible<_Fd, _Gp>::value
+                               >::type>
       _LIBCPP_INLINE_VISIBILITY
       explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
         : __f_(_VSTD::forward<_Gp>(__f)),





More information about the cfe-commits mailing list