From a64f2fbc09cae6d58a4b944e475f40ec491c0a26 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Wed, 25 Feb 2015 12:20:52 +0000 Subject: [PATCH] Add trailing return types (and noexcept specifications) to the 'diamond operators'. Fixes PR#22600. llvm-svn: 230484 --- libcxx/include/__functional_base | 4 ++- libcxx/include/functional | 72 ++++++++++++++++++++++++++++++---------- 2 files changed, 57 insertions(+), 19 deletions(-) diff --git a/libcxx/include/__functional_base b/libcxx/include/__functional_base index e174e0c..09424bc 100644 --- a/libcxx/include/__functional_base +++ b/libcxx/include/__functional_base @@ -70,7 +70,9 @@ struct _LIBCPP_TYPE_VIS_ONLY less template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif diff --git a/libcxx/include/functional b/libcxx/include/functional index 36d422c..070347a 100644 --- a/libcxx/include/functional +++ b/libcxx/include/functional @@ -504,7 +504,9 @@ struct _LIBCPP_TYPE_VIS_ONLY plus template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -529,7 +531,9 @@ struct _LIBCPP_TYPE_VIS_ONLY minus template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -554,7 +558,9 @@ struct _LIBCPP_TYPE_VIS_ONLY multiplies template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -579,7 +585,9 @@ struct _LIBCPP_TYPE_VIS_ONLY divides template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -604,7 +612,9 @@ struct _LIBCPP_TYPE_VIS_ONLY modulus template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -629,7 +639,9 @@ struct _LIBCPP_TYPE_VIS_ONLY negate template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_Tp&& __x) const - { return -_VSTD::forward<_Tp>(__x); } + _NOEXCEPT_(noexcept(- _VSTD::forward<_Tp>(__x))) + -> decltype (- _VSTD::forward<_Tp>(__x)) + { return - _VSTD::forward<_Tp>(__x); } typedef void is_transparent; }; #endif @@ -654,7 +666,9 @@ struct _LIBCPP_TYPE_VIS_ONLY equal_to template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -679,7 +693,9 @@ struct _LIBCPP_TYPE_VIS_ONLY not_equal_to template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -704,7 +720,9 @@ struct _LIBCPP_TYPE_VIS_ONLY greater template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -731,7 +749,9 @@ struct _LIBCPP_TYPE_VIS_ONLY greater_equal template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -756,7 +776,9 @@ struct _LIBCPP_TYPE_VIS_ONLY less_equal template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -781,7 +803,9 @@ struct _LIBCPP_TYPE_VIS_ONLY logical_and template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -806,7 +830,9 @@ struct _LIBCPP_TYPE_VIS_ONLY logical_or template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -831,7 +857,9 @@ struct _LIBCPP_TYPE_VIS_ONLY logical_not template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_Tp&& __x) const - { return !_VSTD::forward<_Tp>(__x); } + _NOEXCEPT_(noexcept(!_VSTD::forward<_Tp>(__x))) + -> decltype (!_VSTD::forward<_Tp>(__x)) + { return !_VSTD::forward<_Tp>(__x); } typedef void is_transparent; }; #endif @@ -856,7 +884,9 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_and template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -881,7 +911,9 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_or template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -906,7 +938,9 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_xor template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_T1&& __t, _T2&& __u) const - { return _VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u); } + _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u))) + -> decltype (_VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u)) + { return _VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u); } typedef void is_transparent; }; #endif @@ -927,7 +961,9 @@ struct _LIBCPP_TYPE_VIS_ONLY bit_not template _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY auto operator()(_Tp&& __x) const - { return ~_VSTD::forward<_Tp>(__x); } + _NOEXCEPT_(noexcept(~_VSTD::forward<_Tp>(__x))) + -> decltype (~_VSTD::forward<_Tp>(__x)) + { return ~_VSTD::forward<_Tp>(__x); } typedef void is_transparent; }; #endif -- 2.7.4