[Bug libstdc++/64651] New: std::rethrow_exception not found by ADL

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jan 17 23:02:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64651

            Bug ID: 64651
           Summary: std::rethrow_exception not found by ADL
           Product: gcc
           Version: 4.9.3
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org

This fails (using -std=c++11):

#include <exception>

int main()
{
  std::exception_ptr e;
  rethrow_exception(e);
}

The standard declares:

  typedef _unspecified_ exception_ptr;

  [[noreturn]] void rethrow_exception(exception_ptr p);

So it's conforming for exception_ptr to be a typedef for a type in a different
namespace, and in that case ADL won't find std::rethrow_exception, but it's not
very helpful to users for it to fail.

This makes it work as expected:

--- 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



More information about the Gcc-bugs mailing list