aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely.gcc@gmail.com>2013-09-27 14:06:09 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2013-09-27 15:06:09 +0100
commitd02dae41e36f20671627506c22bfff7e0f89bc8d (patch)
treef2364513f4ee3b4f72523313fcc4953c60825319
parent09dc585e9af0a2c2fe39674d4f2936428e9498dd (diff)
downloadgcc-d02dae41e36f20671627506c22bfff7e0f89bc8d.zip
gcc-d02dae41e36f20671627506c22bfff7e0f89bc8d.tar.gz
gcc-d02dae41e36f20671627506c22bfff7e0f89bc8d.tar.bz2
re PR libstdc++/57465 (Failed postcondition for std::function constructed with null function pointer)
PR libstdc++/57465 * include/std/functional (_Function_base::_Base_manager::_M_not_empty_function): Fix overload for pointers. * testsuite/20_util/function/cons/57465.cc: New. From-SVN: r202974
-rw-r--r--libstdc++-v3/ChangeLog8
-rw-r--r--libstdc++-v3/include/std/functional2
-rw-r--r--libstdc++-v3/testsuite/20_util/function/cons/57465.cc31
3 files changed, 40 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index fe15508..fccf708 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2013-08-07 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/57465
+ * include/std/functional
+ (_Function_base::_Base_manager::_M_not_empty_function): Fix overload
+ for pointers.
+ * testsuite/20_util/function/cons/57465.cc: New.
+
2013-09-26 Tim Shen <timshen91@gmail.com>
* regex_error.h: Remove _S_error_last to follow the standard.
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 63ba777..73cddfe 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -1932,7 +1932,7 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
template<typename _Tp>
static bool
- _M_not_empty_function(const _Tp*& __fp)
+ _M_not_empty_function(_Tp* const& __fp)
{ return __fp; }
template<typename _Class, typename _Tp>
diff --git a/libstdc++-v3/testsuite/20_util/function/cons/57465.cc b/libstdc++-v3/testsuite/20_util/function/cons/57465.cc
new file mode 100644
index 0000000..44413fb
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/function/cons/57465.cc
@@ -0,0 +1,31 @@
+// Copyright (C) 2013 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/>.
+
+// libstdc++/57465
+
+// { dg-options "-std=gnu++11" }
+
+#include <functional>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ using F = void();
+ F* f = nullptr;
+ std::function<F> x(f);
+ VERIFY( !x );
+}