summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/std/functional
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2014-05-06 11:45:14 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2014-05-06 11:45:14 +0000
commita1f604e51c75b9ad8ba24e7158e993fb0143a3f4 (patch)
tree3cd5195a9a9762f5466c13768d028890a952a55c /libstdc++-v3/include/std/functional
parent9da8c66b2f83b192c4ffe8fa6badfea2fa1403a3 (diff)
downloadppe42-gcc-a1f604e51c75b9ad8ba24e7158e993fb0143a3f4.tar.gz
ppe42-gcc-a1f604e51c75b9ad8ba24e7158e993fb0143a3f4.zip
Backport libstdc++/60594 fix from mainline.
PR libstdc++/60594 * include/std/functional (function::_Callable): Exclude own type from the callable checks. * testsuite/20_util/function/60594.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@210103 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/std/functional')
-rw-r--r--libstdc++-v3/include/std/functional11
1 files changed, 9 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 5a987d914b1..0e80fa37cf4 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -2149,8 +2149,15 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
using _Invoke = decltype(__callable_functor(std::declval<_Functor&>())
(std::declval<_ArgTypes>()...) );
+ // Used so the return type convertibility checks aren't done when
+ // performing overload resolution for copy construction/assignment.
+ template<typename _Tp>
+ using _NotSelf = __not_<is_same<_Tp, function>>;
+
template<typename _Functor>
- using _Callable = __check_func_return_type<_Invoke<_Functor>, _Res>;
+ using _Callable
+ = __and_<_NotSelf<_Functor>,
+ __check_func_return_type<_Invoke<_Functor>, _Res>>;
template<typename _Cond, typename _Tp>
using _Requires = typename enable_if<_Cond::value, _Tp>::type;
@@ -2291,7 +2298,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
* reference_wrapper<F>, this function will not throw.
*/
template<typename _Functor>
- _Requires<_Callable<_Functor>, function&>
+ _Requires<_Callable<typename decay<_Functor>::type>, function&>
operator=(_Functor&& __f)
{
function(std::forward<_Functor>(__f)).swap(*this);
OpenPOWER on IntegriCloud