* [patch] libstdc++/64651 allow rethrow_exception to be found by ADL
@ 2015-11-11 10:10 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2015-11-11 10:10 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 245 bytes --]
As I wrote in the PR, the standard doesn't require that
std::rethrow_exception can be found by ADL, because exception_ptr is
not necessarily defined in namespace std. This ensures it will be
found.
Tested powerpc64le-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1964 bytes --]
commit 920a18f991d3604bf2dfdf9679411b012964f23d
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Nov 11 09:56:22 2015 +0000
PR libstdc++/64651
* libsupc++/exception_ptr.h (rethrow_exception): Add using-declaration
to __exception_ptr namespace.
* testsuite/18_support/exception_ptr/rethrow_exception.cc: Test ADL.
Remove unnecessary test variables.
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h
index 8fbad1c..7821c14 100644
--- a/libstdc++-v3/libsupc++/exception_ptr.h
+++ b/libstdc++-v3/libsupc++/exception_ptr.h
@@ -68,6 +68,8 @@ namespace std
namespace __exception_ptr
{
+ using std::rethrow_exception;
+
/**
* @brief An opaque pointer to an arbitrary exception.
* @ingroup exceptions
diff --git a/libstdc++-v3/testsuite/18_support/exception_ptr/rethrow_exception.cc b/libstdc++-v3/testsuite/18_support/exception_ptr/rethrow_exception.cc
index 31da2ec..7d39892 100644
--- a/libstdc++-v3/testsuite/18_support/exception_ptr/rethrow_exception.cc
+++ b/libstdc++-v3/testsuite/18_support/exception_ptr/rethrow_exception.cc
@@ -30,7 +30,6 @@
void test01()
{
- bool test __attribute__((unused)) = true;
using namespace std;
try {
@@ -54,7 +53,6 @@ void test02()
void test03()
{
- bool test __attribute__((unused)) = true;
using namespace std;
exception_ptr ep;
@@ -71,7 +69,6 @@ void test03()
void test04()
{
- bool test __attribute__((unused)) = true;
using namespace std;
// Weave the exceptions in an attempt to confuse the machinery.
@@ -103,12 +100,23 @@ void test04()
}
}
+void test05()
+{
+ // libstdc++/64651 std::rethrow_exception not found by ADL
+ // This is not required to work but is a conforming extension.
+ try {
+ rethrow_exception(std::make_exception_ptr(0));
+ } catch(...) {
+ }
+}
+
int main()
{
test01();
test02();
test03();
test04();
+ test05();
return 0;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-11-11 10:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-11 10:10 [patch] libstdc++/64651 allow rethrow_exception to be found by ADL Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).