Skip to content

Commit df7aad4

Browse files
author
Howard Hinnant
committed
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>.
llvm-svn: 156182
1 parent ae29842 commit df7aad4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

libcxx/include/functional

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1707,7 +1707,11 @@ public:
17071707

17081708
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
17091709

1710-
template <class _Gp, class ..._BA>
1710+
template <class _Gp, class ..._BA,
1711+
class = typename enable_if
1712+
<
1713+
is_constructible<_Fd, _Gp>::value
1714+
>::type>
17111715
_LIBCPP_INLINE_VISIBILITY
17121716
explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
17131717
: __f_(_VSTD::forward<_Gp>(__f)),

0 commit comments

Comments
 (0)