aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely.gcc@gmail.com>2013-01-07 00:50:16 +0000
committerJonathan Wakely <jwakely.gcc@gmail.com>2013-01-07 00:50:16 +0000
commit620c875fd368f34e1780f255434615739e371f3f (patch)
treeecf9ebe03a77251e2a455aa79bb45c39aac2be8c
parentbe16ce6b632b2d6d7e935782bb9e9d75bee9cbad (diff)
PR libstdc++/55847
* src/c++11/shared_ptr.cc (bad_weak_ptr::what()): Correct string. * testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc: Verify string. PR libstdc++/55728 * include/std/functional (bad_function_call::what()): Declare. * src/c++11/functional.cc (bad_function_call::what()): Define. * config/abi/pre/gnu.ver (bad_function_call::what()): Export. * testsuite/20_util/bad_function_call/what.cc: New. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@194958 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog13
-rw-r--r--libstdc++-v3/config/abi/pre/gnu.ver3
-rw-r--r--libstdc++-v3/include/std/functional4
-rw-r--r--libstdc++-v3/src/c++11/functional.cc9
-rw-r--r--libstdc++-v3/src/c++11/shared_ptr.cc5
-rw-r--r--libstdc++-v3/testsuite/20_util/bad_function_call/what.cc33
-rw-r--r--libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc7
7 files changed, 64 insertions, 10 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ab150bec331..e043d6bb89e 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,16 @@
+2013-01-07 Jonathan Wakely <jwakely.gcc@gmail.com>
+
+ PR libstdc++/55847
+ * src/c++11/shared_ptr.cc (bad_weak_ptr::what()): Correct string.
+ * testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc: Verify
+ string.
+
+ PR libstdc++/55728
+ * include/std/functional (bad_function_call::what()): Declare.
+ * src/c++11/functional.cc (bad_function_call::what()): Define.
+ * config/abi/pre/gnu.ver (bad_function_call::what()): Export.
+ * testsuite/20_util/bad_function_call/what.cc: New.
+
2013-01-06 Jonathan Wakely <jwakely.gcc@gmail.com>
* include/bits/unordered_map.h: Fix typo in comments.
diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver
index 8b1ec0da917..35b4c44de9d 100644
--- a/libstdc++-v3/config/abi/pre/gnu.ver
+++ b/libstdc++-v3/config/abi/pre/gnu.ver
@@ -1342,6 +1342,9 @@ GLIBCXX_3.4.18 {
# std::this_thread::__sleep_for
_ZNSt11this_thread11__sleep_for*;
+ # std::bad_function_call::what()
+ _ZNKSt17bad_function_call4whatEv;
+
} GLIBCXX_3.4.17;
# Symbols in the support library (libsupc++) have their own tag.
diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index 3ec2e1ea4ed..0b5d47507ca 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -1,6 +1,6 @@
// <functional> -*- C++ -*-
-// Copyright (C) 2001-2012 Free Software Foundation, Inc.
+// Copyright (C) 2001-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
@@ -1767,6 +1767,8 @@ _GLIBCXX_HAS_NESTED_TYPE(result_type)
{
public:
virtual ~bad_function_call() noexcept;
+
+ const char* what() const noexcept;
};
/**
diff --git a/libstdc++-v3/src/c++11/functional.cc b/libstdc++-v3/src/c++11/functional.cc
index 2ab34051432..8d81f6028eb 100644
--- a/libstdc++-v3/src/c++11/functional.cc
+++ b/libstdc++-v3/src/c++11/functional.cc
@@ -1,7 +1,6 @@
// Support for <functional> -*- C++ -*-
-// Copyright (C) 2011
-// Free Software Foundation, Inc.
+// Copyright (C) 2011-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
@@ -29,7 +28,11 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
- bad_function_call::~bad_function_call() throw() = default;
+ bad_function_call::~bad_function_call() noexcept = default;
+
+ const char*
+ bad_function_call::what() const noexcept
+ { return "bad_function_call"; }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/src/c++11/shared_ptr.cc b/libstdc++-v3/src/c++11/shared_ptr.cc
index 911e745ebe2..ca5714a318d 100644
--- a/libstdc++-v3/src/c++11/shared_ptr.cc
+++ b/libstdc++-v3/src/c++11/shared_ptr.cc
@@ -1,7 +1,6 @@
// Support for pointer abstractions -*- C++ -*-
-// Copyright (C) 2011
-// Free Software Foundation, Inc.
+// Copyright (C) 2011-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
@@ -33,7 +32,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
char const*
bad_weak_ptr::what() const noexcept
- { return "std::bad_weak_ptr"; }
+ { return "bad_weak_ptr"; }
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
diff --git a/libstdc++-v3/testsuite/20_util/bad_function_call/what.cc b/libstdc++-v3/testsuite/20_util/bad_function_call/what.cc
new file mode 100644
index 00000000000..4d9c8b4cd0a
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/bad_function_call/what.cc
@@ -0,0 +1,33 @@
+// { dg-options "-std=gnu++11" }
+
+// 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/>.
+
+#include <functional>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ try
+ {
+ std::function<void()>{}();
+ }
+ catch (const std::exception& e)
+ {
+ VERIFY( e.what() == std::string("bad_function_call") );
+ }
+}
diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc
index d2bf508fd99..2d655d7155d 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc
@@ -1,6 +1,6 @@
// { dg-options "-std=gnu++0x" }
-// Copyright (C) 2005, 2006, 2007, 2009, 2012 Free Software Foundation
+// Copyright (C) 2005-2013 Free Software Foundation
//
// 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
@@ -40,10 +40,11 @@ test01()
{
std::shared_ptr<A> a2(wa);
}
- catch (const std::bad_weak_ptr&)
+ catch (const std::bad_weak_ptr& e)
{
// Expected.
- test = true;
+ if (e.what() == std::string("bad_weak_ptr"))
+ test = true;
}
VERIFY( test );