aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2017-05-18 18:32:06 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2017-05-18 18:32:06 +0100
commit747217d179fc6293fa6f3dda7ac21b58574c2ecf (patch)
tree8bc96b9a42c434c7e66e22dcee483ee31007c22b
parent286c97f38fc529d29a7e8560b29e2c93ed25e21d (diff)
downloadgcc-747217d179fc6293fa6f3dda7ac21b58574c2ecf.zip
gcc-747217d179fc6293fa6f3dda7ac21b58574c2ecf.tar.gz
gcc-747217d179fc6293fa6f3dda7ac21b58574c2ecf.tar.bz2
PR libstdc++/80478 make std::mem_fn work with noexcept functions
PR libstdc++/80478 * include/std/functional (_Mem_fn_traits_base): Add specializations for noexcept member function types. * testsuite/20_util/function_objects/mem_fn/80478.cc: New test. From-SVN: r248245
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/std/functional6
-rw-r--r--libstdc++-v3/testsuite/20_util/function_objects/mem_fn/80478.cc27
3 files changed, 40 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index c286818..ae45726 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,5 +1,12 @@
2017-05-18 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/80478
+ * include/std/functional (_Mem_fn_traits_base): Add specializations
+ for noexcept member function types.
+ * testsuite/20_util/function_objects/mem_fn/80478.cc: New test.
+
+2017-05-18 Jonathan Wakely <jwakely@redhat.com>
+
* doc/xml/manual/policy_data_structures.xml: Fix typo.
* doc/xml/manual/test_policy_data_structures.xml: Likewise.
* doc/html/*: Regenerate.
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index e4a82ee..465b3ec 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -135,6 +135,12 @@ _GLIBCXX_MEM_FN_TRAITS( , true_type, true_type)
_GLIBCXX_MEM_FN_TRAITS(&, true_type, false_type)
_GLIBCXX_MEM_FN_TRAITS(&&, false_type, true_type)
+#if __cplusplus > 201402L
+_GLIBCXX_MEM_FN_TRAITS(noexcept, true_type, true_type)
+_GLIBCXX_MEM_FN_TRAITS(& noexcept, true_type, false_type)
+_GLIBCXX_MEM_FN_TRAITS(&& noexcept, false_type, true_type)
+#endif
+
#undef _GLIBCXX_MEM_FN_TRAITS
#undef _GLIBCXX_MEM_FN_TRAITS2
diff --git a/libstdc++-v3/testsuite/20_util/function_objects/mem_fn/80478.cc b/libstdc++-v3/testsuite/20_util/function_objects/mem_fn/80478.cc
new file mode 100644
index 0000000..f49fcaa
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/function_objects/mem_fn/80478.cc
@@ -0,0 +1,27 @@
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17" }
+// { dg-do compile { target c++1z } }
+
+#include <functional>
+
+struct X {
+ void f() noexcept { }
+};
+
+auto f = std::mem_fn(&X::f);