diff options
Diffstat (limited to 'contrib/libc++/include/__functional_03')
| -rw-r--r-- | contrib/libc++/include/__functional_03 | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/contrib/libc++/include/__functional_03 b/contrib/libc++/include/__functional_03 index 4edbb0996ca0..1db7082eb3d6 100644 --- a/contrib/libc++/include/__functional_03 +++ b/contrib/libc++/include/__functional_03 @@ -445,7 +445,7 @@ __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target_type() const } // __function template<class _Rp> -class _LIBCPP_TYPE_VIS_ONLY function<_Rp()> +class _LIBCPP_TEMPLATE_VIS function<_Rp()> { typedef __function::__base<_Rp()> __base; aligned_storage<3*sizeof(void*)>::type __buf_; @@ -642,6 +642,8 @@ template<class _Rp> void function<_Rp()>::swap(function& __f) { + if (_VSTD::addressof(__f) == this) + return; if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) { typename aligned_storage<sizeof(__buf_)>::type __tempbuf; @@ -679,10 +681,8 @@ template<class _Rp> _Rp function<_Rp()>::operator()() const { -#ifndef _LIBCPP_NO_EXCEPTIONS if (__f_ == 0) - throw bad_function_call(); -#endif // _LIBCPP_NO_EXCEPTIONS + __throw_bad_function_call(); return (*__f_)(); } @@ -720,7 +720,7 @@ function<_Rp()>::target() const #endif // _LIBCPP_NO_RTTI template<class _Rp, class _A0> -class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0)> +class _LIBCPP_TEMPLATE_VIS function<_Rp(_A0)> : public unary_function<_A0, _Rp> { typedef __function::__base<_Rp(_A0)> __base; @@ -918,6 +918,8 @@ template<class _Rp, class _A0> void function<_Rp(_A0)>::swap(function& __f) { + if (_VSTD::addressof(__f) == this) + return; if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) { typename aligned_storage<sizeof(__buf_)>::type __tempbuf; @@ -955,10 +957,8 @@ template<class _Rp, class _A0> _Rp function<_Rp(_A0)>::operator()(_A0 __a0) const { -#ifndef _LIBCPP_NO_EXCEPTIONS if (__f_ == 0) - throw bad_function_call(); -#endif // _LIBCPP_NO_EXCEPTIONS + __throw_bad_function_call(); return (*__f_)(__a0); } @@ -996,7 +996,7 @@ function<_Rp(_A0)>::target() const #endif // _LIBCPP_NO_RTTI template<class _Rp, class _A0, class _A1> -class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1)> +class _LIBCPP_TEMPLATE_VIS function<_Rp(_A0, _A1)> : public binary_function<_A0, _A1, _Rp> { typedef __function::__base<_Rp(_A0, _A1)> __base; @@ -1194,6 +1194,8 @@ template<class _Rp, class _A0, class _A1> void function<_Rp(_A0, _A1)>::swap(function& __f) { + if (_VSTD::addressof(__f) == this) + return; if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) { typename aligned_storage<sizeof(__buf_)>::type __tempbuf; @@ -1231,10 +1233,8 @@ template<class _Rp, class _A0, class _A1> _Rp function<_Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const { -#ifndef _LIBCPP_NO_EXCEPTIONS if (__f_ == 0) - throw bad_function_call(); -#endif // _LIBCPP_NO_EXCEPTIONS + __throw_bad_function_call(); return (*__f_)(__a0, __a1); } @@ -1272,7 +1272,7 @@ function<_Rp(_A0, _A1)>::target() const #endif // _LIBCPP_NO_RTTI template<class _Rp, class _A0, class _A1, class _A2> -class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1, _A2)> +class _LIBCPP_TEMPLATE_VIS function<_Rp(_A0, _A1, _A2)> { typedef __function::__base<_Rp(_A0, _A1, _A2)> __base; aligned_storage<3*sizeof(void*)>::type __buf_; @@ -1470,6 +1470,8 @@ template<class _Rp, class _A0, class _A1, class _A2> void function<_Rp(_A0, _A1, _A2)>::swap(function& __f) { + if (_VSTD::addressof(__f) == this) + return; if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_) { typename aligned_storage<sizeof(__buf_)>::type __tempbuf; @@ -1507,10 +1509,8 @@ template<class _Rp, class _A0, class _A1, class _A2> _Rp function<_Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const { -#ifndef _LIBCPP_NO_EXCEPTIONS if (__f_ == 0) - throw bad_function_call(); -#endif // _LIBCPP_NO_EXCEPTIONS + __throw_bad_function_call(); return (*__f_)(__a0, __a1, __a2); } |
