This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]