diff mbox

fix libstdc++/57465

Message ID CAH6eHdT7USzTU1dZtvahWk6pkNbu1Q=0PjeGk_QRCfRdXENquQ@mail.gmail.com
State New
Headers show

Commit Message

Jonathan Wakely Sept. 27, 2013, 2:08 p.m. UTC
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.


Tested x86_64-linux, committed to trunk.  I'll apply it to the
branches after it's been on trunk without problems for a while.
commit 55531e9c74a5f2b4699250b6b302d49f7dc8c5ae
Author: Jonathan Wakely <jwakely.gcc@gmail.com>
Date:   Wed Aug 7 01:38:39 2013 +0100

    	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.
diff mbox

Patch

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 );
+}