From fb7b97cfbb42b26da57f3c181ab6caa1b957f677 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Sun, 25 Oct 2015 20:12:16 +0000 Subject: [PATCH] Fix LWG#2489: mem_fn() should be noexcept git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@251257 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/functional | 4 ++-- .../function.objects/func.memfn/member_function.pass.cpp | 3 +++ www/cxx1z_status.html | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/functional b/include/functional index 13286482d..dbe9b01bb 100644 --- a/include/functional +++ b/include/functional @@ -1249,7 +1249,7 @@ private: type __f_; public: - _LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) : __f_(__f) {} + _LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) _NOEXCEPT : __f_(__f) {} #ifndef _LIBCPP_HAS_NO_VARIADICS // invoke @@ -1364,7 +1364,7 @@ public: template inline _LIBCPP_INLINE_VISIBILITY __mem_fn<_Rp _Tp::*> -mem_fn(_Rp _Tp::* __pm) +mem_fn(_Rp _Tp::* __pm) _NOEXCEPT { return __mem_fn<_Rp _Tp::*>(__pm); } diff --git a/test/std/utilities/function.objects/func.memfn/member_function.pass.cpp b/test/std/utilities/function.objects/func.memfn/member_function.pass.cpp index 4096bd814..f371223ee 100644 --- a/test/std/utilities/function.objects/func.memfn/member_function.pass.cpp +++ b/test/std/utilities/function.objects/func.memfn/member_function.pass.cpp @@ -69,4 +69,7 @@ int main() test0(std::mem_fn(&A::test0)); test1(std::mem_fn(&A::test1)); test2(std::mem_fn(&A::test2)); +#if __has_feature(cxx_noexcept) + static_assert((noexcept(std::mem_fn(&A::test0))), ""); // LWG#2489 +#endif } diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index 5f582f1c7..c12785a43 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html @@ -175,14 +175,14 @@ 2466allocator_traits::max_size() default behavior is incorrectKonaComplete 2469Wrong specification of Requires clause of operator[] for map and unordered_mapKona 2473basic_filebuf's relation to C FILE semanticsKonaComplete - 2476scoped_allocator_adaptor is not assignableKonaPatch Ready + 2476scoped_allocator_adaptor is not assignableKonaComplete 2477Inconsistency of wordings in std::vector::erase() and std::deque::erase()KonaComplete 2483throw_with_nested() should use is_finalKonaComplete 2484rethrow_if_nested() is doubly unimplementableKonaComplete 2485get() should be overloaded for const tuple&&Kona 2486mem_fn() should be required to use perfect forwardingKona 2487bind() should be const-overloaded, not cv-overloadedKonaComplete - 2489mem_fn() should be noexceptKonaPatch Ready + 2489mem_fn() should be noexceptKonaComplete 2492Clarify requirements for compKonaComplete 2495There is no such thing as an Exception Safety elementKona