Hi,

this fixes the issue in the obvious way, by explicitly declaring nested_exception::~nested_exception noexcept, necessary today due to PR50043. I took the occasion to deploy _GLIBCXX_USE_NOEXCEPT in more places, exception classes and chrono.

Tested x86_64-linux, -enable-libstdcxx-time=rt, committed.

Thanks,
Paolo.

//////////////////////////

2011-12-06  Paolo Carlini  <paolo.carl...@oracle.com>

        PR libstdc++/51438
        * libsupc++/nested_exception.h (nested_exception::~nested_exception):
        Declare noexcept.
        * libsupc++/nested_exception.cc: Adjust.
        * testsuite/18_support/nested_exception/51438.cc: New.
        * testsuite/18_support/nested_exception/throw_with_nested.cc: Adjust.
        * testsuite/18_support/nested_exception/rethrow_if_nested.cc:
        Likewise.

        * src/shared_ptr.cc: Use noexcept where appropriate.
        * include/std/system_error: Likewise.
        * include/std/functional: Likewise.
        * include/bits/shared_ptr_base.h: Likewise.
        * src/stdexcept.cc: Use _GLIBCXX_USE_NOEXCEPT where appropriate.
        * include/std/stdexcept: Likewise.
        * libsupc++/bad_cast.cc: Likewise.
        * libsupc++/bad_typeid.cc: Likewise.
        * libsupc++/eh_exception.cc: Likewise.
        * libsupc++/typeinfo: Likewise.
        * libsupc++/exception: Likewise.
        * libsupc++/eh_ptr.cc: Likewise.
        * libsupc++/bad_alloc.cc: Likewise.
        * libsupc++/exception_ptr.h: Likewise.

        * include/std/chrono: Use noexcept where appropriate.
        * src/chrono.cc: Likewise.
Index: src/shared_ptr.cc
===================================================================
--- src/shared_ptr.cc   (revision 182054)
+++ src/shared_ptr.cc   (working copy)
@@ -29,10 +29,10 @@
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
-  bad_weak_ptr::~bad_weak_ptr() throw() = default;
+  bad_weak_ptr::~bad_weak_ptr() noexcept = default;
 
   char const*
-  bad_weak_ptr::what() const throw()  
+  bad_weak_ptr::what() const noexcept
   { return "std::bad_weak_ptr"; }
 
 _GLIBCXX_END_NAMESPACE_VERSION
Index: src/stdexcept.cc
===================================================================
--- src/stdexcept.cc    (revision 182054)
+++ src/stdexcept.cc    (working copy)
@@ -37,55 +37,55 @@
   logic_error::logic_error(const string& __arg)
   : exception(), _M_msg(__arg) { }
 
-  logic_error::~logic_error() throw() { }
+  logic_error::~logic_error() _GLIBCXX_USE_NOEXCEPT { }
 
   const char*
-  logic_error::what() const throw()
+  logic_error::what() const _GLIBCXX_USE_NOEXCEPT
   { return _M_msg.c_str(); }
 
   domain_error::domain_error(const string& __arg)
   : logic_error(__arg) { }
 
-  domain_error::~domain_error() throw() { }
+  domain_error::~domain_error() _GLIBCXX_USE_NOEXCEPT { }
 
   invalid_argument::invalid_argument(const string& __arg)
   : logic_error(__arg) { }
 
-  invalid_argument::~invalid_argument() throw() { }
+  invalid_argument::~invalid_argument() _GLIBCXX_USE_NOEXCEPT { }
 
   length_error::length_error(const string& __arg)
   : logic_error(__arg) { }
 
-  length_error::~length_error() throw() { }
+  length_error::~length_error() _GLIBCXX_USE_NOEXCEPT { }
 
   out_of_range::out_of_range(const string& __arg)
   : logic_error(__arg) { }
 
-  out_of_range::~out_of_range() throw() { }
+  out_of_range::~out_of_range() _GLIBCXX_USE_NOEXCEPT { }
 
   runtime_error::runtime_error(const string& __arg)
   : exception(), _M_msg(__arg) { }
 
-  runtime_error::~runtime_error() throw() { }
+  runtime_error::~runtime_error() _GLIBCXX_USE_NOEXCEPT { }
 
   const char*
-  runtime_error::what() const throw()
+  runtime_error::what() const _GLIBCXX_USE_NOEXCEPT
   { return _M_msg.c_str(); }
 
   range_error::range_error(const string& __arg)
   : runtime_error(__arg) { }
 
-  range_error::~range_error() throw() { }
+  range_error::~range_error() _GLIBCXX_USE_NOEXCEPT { }
 
   overflow_error::overflow_error(const string& __arg)
   : runtime_error(__arg) { }
 
-  overflow_error::~overflow_error() throw() { }
+  overflow_error::~overflow_error() _GLIBCXX_USE_NOEXCEPT { }
 
   underflow_error::underflow_error(const string& __arg)
   : runtime_error(__arg) { }
 
-  underflow_error::~underflow_error() throw() { }
+  underflow_error::~underflow_error() _GLIBCXX_USE_NOEXCEPT { }
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
Index: src/chrono.cc
===================================================================
--- src/chrono.cc       (revision 182054)
+++ src/chrono.cc       (working copy)
@@ -42,7 +42,7 @@
     constexpr bool system_clock::is_steady;
 
     system_clock::time_point
-    system_clock::now() throw ()
+    system_clock::now() noexcept
     {
 #ifdef _GLIBCXX_USE_CLOCK_REALTIME
       timespec tp;
@@ -64,9 +64,9 @@
     
 #ifdef _GLIBCXX_USE_CLOCK_MONOTONIC
     constexpr bool steady_clock::is_steady;
-    
+
     steady_clock::time_point
-    steady_clock::now()
+    steady_clock::now() noexcept
     {
       timespec tp;
       // -EINVAL, -EFAULT
Index: include/std/system_error
===================================================================
--- include/std/system_error    (revision 182054)
+++ include/std/system_error    (working copy)
@@ -337,7 +337,7 @@
     : runtime_error(__what + ": " + error_code(__v, __ecat).message()),
       _M_code(__v, __ecat) { }
 
-    virtual ~system_error() throw();
+    virtual ~system_error() noexcept;
 
     const error_code& 
     code() const noexcept { return _M_code; }
Index: include/std/stdexcept
===================================================================
--- include/std/stdexcept       (revision 182054)
+++ include/std/stdexcept       (working copy)
@@ -62,12 +62,12 @@
     explicit 
     logic_error(const string& __arg);
 
-    virtual ~logic_error() throw();
+    virtual ~logic_error() _GLIBCXX_USE_NOEXCEPT;
 
     /** Returns a C-style character string describing the general cause of
      *  the current error (the same string passed to the ctor).  */
     virtual const char* 
-    what() const throw();
+    what() const _GLIBCXX_USE_NOEXCEPT;
   };
 
   /** Thrown by the library, or by you, to report domain errors (domain in
@@ -76,7 +76,7 @@
   {
   public:
     explicit domain_error(const string& __arg);
-    virtual ~domain_error() throw();
+    virtual ~domain_error() _GLIBCXX_USE_NOEXCEPT;
   };
 
   /** Thrown to report invalid arguments to functions.  */
@@ -84,7 +84,7 @@
   {
   public:
     explicit invalid_argument(const string& __arg);
-    virtual ~invalid_argument() throw();
+    virtual ~invalid_argument() _GLIBCXX_USE_NOEXCEPT;
   };
 
   /** Thrown when an object is constructed that would exceed its maximum
@@ -93,7 +93,7 @@
   {
   public:
     explicit length_error(const string& __arg);
-    virtual ~length_error() throw();
+    virtual ~length_error() _GLIBCXX_USE_NOEXCEPT;
   };
 
   /** This represents an argument whose value is not within the expected
@@ -102,7 +102,7 @@
   {
   public:
     explicit out_of_range(const string& __arg);
-    virtual ~out_of_range() throw();
+    virtual ~out_of_range() _GLIBCXX_USE_NOEXCEPT;
   };
 
   /** Runtime errors represent problems outside the scope of a program;
@@ -119,12 +119,12 @@
     explicit 
     runtime_error(const string& __arg);
 
-    virtual ~runtime_error() throw();
+    virtual ~runtime_error() _GLIBCXX_USE_NOEXCEPT;
 
     /** Returns a C-style character string describing the general cause of
      *  the current error (the same string passed to the ctor).  */
     virtual const char* 
-    what() const throw();
+    what() const _GLIBCXX_USE_NOEXCEPT;
   };
 
   /** Thrown to indicate range errors in internal computations.  */
@@ -132,7 +132,7 @@
   {
   public:
     explicit range_error(const string& __arg);
-    virtual ~range_error() throw();
+    virtual ~range_error() _GLIBCXX_USE_NOEXCEPT;
   };
 
   /** Thrown to indicate arithmetic overflow.  */
@@ -140,7 +140,7 @@
   {
   public:
     explicit overflow_error(const string& __arg);
-    virtual ~overflow_error() throw();
+    virtual ~overflow_error() _GLIBCXX_USE_NOEXCEPT;
   };
 
   /** Thrown to indicate arithmetic underflow.  */
@@ -148,7 +148,7 @@
   {
   public:
     explicit underflow_error(const string& __arg);
-    virtual ~underflow_error() throw();
+    virtual ~underflow_error() _GLIBCXX_USE_NOEXCEPT;
   };
 
   // @} group exceptions
Index: include/std/chrono
===================================================================
--- include/std/chrono  (revision 182054)
+++ include/std/chrono  (working copy)
@@ -686,18 +686,18 @@
       static constexpr bool is_steady = false;
 
       static time_point
-      now() throw ();
+      now() noexcept;
 
       // Map to C API
       static std::time_t
-      to_time_t(const time_point& __t)
+      to_time_t(const time_point& __t) noexcept
       {
        return std::time_t(duration_cast<chrono::seconds>
                           (__t.time_since_epoch()).count());
       }
 
       static time_point
-      from_time_t(std::time_t __t)
+      from_time_t(std::time_t __t) noexcept
       {
        typedef chrono::time_point<system_clock, seconds>       __from;
        return time_point_cast<system_clock::duration>
@@ -717,7 +717,7 @@
       static constexpr bool is_steady = true;
 
       static time_point
-      now();
+      now() noexcept;
     };
 #else
     typedef system_clock steady_clock;
Index: include/std/functional
===================================================================
--- include/std/functional      (revision 182054)
+++ include/std/functional      (working copy)
@@ -1633,7 +1633,7 @@
   class bad_function_call : public std::exception
   {
   public:
-    virtual ~bad_function_call() throw();
+    virtual ~bad_function_call() noexcept;
   };
 
   /**
Index: include/bits/shared_ptr_base.h
===================================================================
--- include/bits/shared_ptr_base.h      (revision 182054)
+++ include/bits/shared_ptr_base.h      (working copy)
@@ -63,7 +63,7 @@
     virtual char const*
     what() const noexcept;
 
-    virtual ~bad_weak_ptr() throw();    
+    virtual ~bad_weak_ptr() noexcept;    
   };
 
   // Substitute for bad_weak_ptr object in the case of -fno-exceptions.
Index: libsupc++/nested_exception.cc
===================================================================
--- libsupc++/nested_exception.cc       (revision 182058)
+++ libsupc++/nested_exception.cc       (working copy)
@@ -26,6 +26,6 @@
 namespace std 
 {
 #if ATOMIC_INT_LOCK_FREE > 1
-  nested_exception::~nested_exception() = default;
+  nested_exception::~nested_exception() noexcept = default;
 #endif
 } // namespace std
Index: libsupc++/bad_cast.cc
===================================================================
--- libsupc++/bad_cast.cc       (revision 182058)
+++ libsupc++/bad_cast.cc       (working copy)
@@ -1,5 +1,5 @@
 // Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007,
-// 2009  Free Software Foundation
+// 2009, 2010, 2011  Free Software Foundation
 //
 // This file is part of GCC.
 //
@@ -26,10 +26,10 @@
 
 namespace std {
 
-bad_cast::~bad_cast() throw() { }
+bad_cast::~bad_cast() _GLIBCXX_USE_NOEXCEPT { }
 
 const char* 
-bad_cast::what() const throw()
+bad_cast::what() const _GLIBCXX_USE_NOEXCEPT
 {
   return "std::bad_cast";
 }
Index: libsupc++/bad_typeid.cc
===================================================================
--- libsupc++/bad_typeid.cc     (revision 182058)
+++ libsupc++/bad_typeid.cc     (working copy)
@@ -1,5 +1,5 @@
 // Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007,
-// 2009  Free Software Foundation
+// 2009, 2010, 2011  Free Software Foundation
 //
 // This file is part of GCC.
 //
@@ -26,10 +26,10 @@
 
 namespace std {
 
-bad_typeid::~bad_typeid() throw() { }
+bad_typeid::~bad_typeid() _GLIBCXX_USE_NOEXCEPT { }
 
 const char* 
-bad_typeid::what() const throw()
+bad_typeid::what() const _GLIBCXX_USE_NOEXCEPT
 {
   return "std::bad_typeid";
 }
Index: libsupc++/eh_exception.cc
===================================================================
--- libsupc++/eh_exception.cc   (revision 182058)
+++ libsupc++/eh_exception.cc   (working copy)
@@ -1,6 +1,6 @@
 // -*- C++ -*- std::exception implementation.
 // Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-// 2003, 2004, 2005, 2006, 2007, 2009
+// 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011
 // Free Software Foundation
 //
 // This file is part of GCC.
@@ -28,16 +28,16 @@
 #include "exception"
 #include <cxxabi.h>
 
-std::exception::~exception() throw() { }
+std::exception::~exception() _GLIBCXX_USE_NOEXCEPT { }
 
-std::bad_exception::~bad_exception() throw() { }
+std::bad_exception::~bad_exception() _GLIBCXX_USE_NOEXCEPT { }
 
 abi::__forced_unwind::~__forced_unwind() throw() { }
 
 abi::__foreign_exception::~__foreign_exception() throw() { }
 
 const char* 
-std::exception::what() const throw()
+std::exception::what() const _GLIBCXX_USE_NOEXCEPT
 {
   // NB: Another elegant option would be returning typeid(*this).name()
   // and not overriding what() in bad_exception, bad_alloc, etc.  In
@@ -46,7 +46,7 @@
 }
 
 const char* 
-std::bad_exception::what() const throw()
+std::bad_exception::what() const _GLIBCXX_USE_NOEXCEPT
 {
   return "std::bad_exception";
 }
Index: libsupc++/typeinfo
===================================================================
--- libsupc++/typeinfo  (revision 182058)
+++ libsupc++/typeinfo  (working copy)
@@ -190,14 +190,14 @@
   class bad_cast : public exception 
   {
   public:
-    bad_cast() throw() { }
+    bad_cast() _GLIBCXX_USE_NOEXCEPT { }
 
     // This declaration is not useless:
     // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
-    virtual ~bad_cast() throw();
+    virtual ~bad_cast() _GLIBCXX_USE_NOEXCEPT;
 
     // See comment in eh_exception.cc.
-    virtual const char* what() const throw();
+    virtual const char* what() const _GLIBCXX_USE_NOEXCEPT;
   };
   
   /** 
@@ -207,14 +207,14 @@
   class bad_typeid : public exception 
   {
   public:
-    bad_typeid () throw() { }
+    bad_typeid () _GLIBCXX_USE_NOEXCEPT { }
 
     // This declaration is not useless:
     // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
-    virtual ~bad_typeid() throw();
+    virtual ~bad_typeid() _GLIBCXX_USE_NOEXCEPT;
 
     // See comment in eh_exception.cc.
-    virtual const char* what() const throw();
+    virtual const char* what() const _GLIBCXX_USE_NOEXCEPT;
   };
 } // namespace std
 
Index: libsupc++/exception
===================================================================
--- libsupc++/exception (revision 182058)
+++ libsupc++/exception (working copy)
@@ -62,12 +62,12 @@
   class exception
   {
   public:
-    exception() throw() { }
-    virtual ~exception() throw();
+    exception() _GLIBCXX_USE_NOEXCEPT { }
+    virtual ~exception() _GLIBCXX_USE_NOEXCEPT;
 
     /** Returns a C-style character string describing the general cause
      *  of the current error.  */
-    virtual const char* what() const throw();
+    virtual const char* what() const _GLIBCXX_USE_NOEXCEPT;
   };
 
   /** If an %exception is thrown which is not listed in a function's
@@ -75,14 +75,14 @@
   class bad_exception : public exception
   {
   public:
-    bad_exception() throw() { }
+    bad_exception() _GLIBCXX_USE_NOEXCEPT { }
 
     // This declaration is not useless:
     // http://gcc.gnu.org/onlinedocs/gcc-3.0.2/gcc_6.html#SEC118
-    virtual ~bad_exception() throw();
+    virtual ~bad_exception() _GLIBCXX_USE_NOEXCEPT;
 
     // See comment in eh_exception.cc.
-    virtual const char* what() const throw();
+    virtual const char* what() const _GLIBCXX_USE_NOEXCEPT;
   };
 
   /// If you write a replacement %terminate handler, it must be of this type.
@@ -92,14 +92,14 @@
   typedef void (*unexpected_handler) ();
 
   /// Takes a new handler function as an argument, returns the old function.
-  terminate_handler set_terminate(terminate_handler) throw();
+  terminate_handler set_terminate(terminate_handler) _GLIBCXX_USE_NOEXCEPT;
 
   /** The runtime will call this function if %exception handling must be
    *  abandoned for any reason.  It can also be called by the user.  */
-  void terminate() throw() __attribute__ ((__noreturn__));
+  void terminate() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__noreturn__));
 
   /// Takes a new handler function as an argument, returns the old function.
-  unexpected_handler set_unexpected(unexpected_handler) throw();
+  unexpected_handler set_unexpected(unexpected_handler) _GLIBCXX_USE_NOEXCEPT;
 
   /** The runtime will call this function if an %exception is thrown which
    *  violates the function's %exception specification.  */
@@ -116,7 +116,7 @@
    *  %exception can result in a call of @c terminate()
    *  (15.5.1).'
    */
-  bool uncaught_exception() throw() __attribute__ ((__pure__));
+  bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
 
   // @} group exceptions
 } // namespace std
Index: libsupc++/eh_ptr.cc
===================================================================
--- libsupc++/eh_ptr.cc (revision 182058)
+++ libsupc++/eh_ptr.cc (working copy)
@@ -35,31 +35,33 @@
 
 using namespace __cxxabiv1;
 
-std::__exception_ptr::exception_ptr::exception_ptr() throw()
+std::__exception_ptr::exception_ptr::exception_ptr() _GLIBCXX_USE_NOEXCEPT
 : _M_exception_object(0) { }
 
 
-std::__exception_ptr::exception_ptr::exception_ptr(void* obj) throw()
+std::__exception_ptr::exception_ptr::exception_ptr(void* obj)
+_GLIBCXX_USE_NOEXCEPT
 : _M_exception_object(obj)  { _M_addref(); }
 
 
-std::__exception_ptr::exception_ptr::exception_ptr(__safe_bool) throw()
+std::__exception_ptr::exception_ptr::exception_ptr(__safe_bool)
+_GLIBCXX_USE_NOEXCEPT
 : _M_exception_object(0) { }
 
 
 std::__exception_ptr::
-exception_ptr::exception_ptr(const exception_ptr& other) throw()
+exception_ptr::exception_ptr(const exception_ptr& other) _GLIBCXX_USE_NOEXCEPT
 : _M_exception_object(other._M_exception_object)
 { _M_addref(); }
 
 
-std::__exception_ptr::exception_ptr::~exception_ptr() throw()
+std::__exception_ptr::exception_ptr::~exception_ptr() _GLIBCXX_USE_NOEXCEPT
 { _M_release(); }
 
 
 std::__exception_ptr::exception_ptr&
 std::__exception_ptr::
-exception_ptr::operator=(const exception_ptr& other) throw()
+exception_ptr::operator=(const exception_ptr& other) _GLIBCXX_USE_NOEXCEPT
 {
   exception_ptr(other).swap(*this);
   return *this;
@@ -67,7 +69,7 @@
 
 
 void
-std::__exception_ptr::exception_ptr::_M_addref() throw()
+std::__exception_ptr::exception_ptr::_M_addref() _GLIBCXX_USE_NOEXCEPT
 {
   if (_M_exception_object)
     {
@@ -79,7 +81,7 @@
 
 
 void
-std::__exception_ptr::exception_ptr::_M_release() throw()
+std::__exception_ptr::exception_ptr::_M_release() _GLIBCXX_USE_NOEXCEPT
 {
   if (_M_exception_object)
     {
@@ -98,12 +100,13 @@
 
 
 void*
-std::__exception_ptr::exception_ptr::_M_get() const throw()
+std::__exception_ptr::exception_ptr::_M_get() const _GLIBCXX_USE_NOEXCEPT
 { return _M_exception_object; }
 
 
 void
-std::__exception_ptr::exception_ptr::swap(exception_ptr &other) throw()
+std::__exception_ptr::exception_ptr::swap(exception_ptr &other)
+  _GLIBCXX_USE_NOEXCEPT
 {
   void *tmp = _M_exception_object;
   _M_exception_object = other._M_exception_object;
@@ -113,24 +116,27 @@
 
 // Retained for compatibility with CXXABI_1.3.
 void
-std::__exception_ptr::exception_ptr::_M_safe_bool_dummy() throw () { }
+std::__exception_ptr::exception_ptr::_M_safe_bool_dummy()
+  _GLIBCXX_USE_NOEXCEPT { }
 
 
 // Retained for compatibility with CXXABI_1.3.
 bool
-std::__exception_ptr::exception_ptr::operator!() const throw()
+std::__exception_ptr::exception_ptr::operator!() const _GLIBCXX_USE_NOEXCEPT
 { return _M_exception_object == 0; }
 
 
 // Retained for compatibility with CXXABI_1.3.
-std::__exception_ptr::exception_ptr::operator __safe_bool() const throw()
+std::__exception_ptr::exception_ptr::operator __safe_bool() const
+_GLIBCXX_USE_NOEXCEPT
 {
   return _M_exception_object ? &exception_ptr::_M_safe_bool_dummy : 0;
 }
 
 
 const std::type_info*
-std::__exception_ptr::exception_ptr::__cxa_exception_type() const throw()
+std::__exception_ptr::exception_ptr::__cxa_exception_type() const
+  _GLIBCXX_USE_NOEXCEPT
 {
   __cxa_exception *eh = __get_exception_header_from_obj (_M_exception_object);
   return eh->exceptionType;
@@ -138,17 +144,19 @@
 
 
 bool std::__exception_ptr::operator==(const exception_ptr& lhs,
-                                     const exception_ptr& rhs) throw()
+                                     const exception_ptr& rhs)
+  _GLIBCXX_USE_NOEXCEPT
 { return lhs._M_exception_object == rhs._M_exception_object; }
 
 
 bool std::__exception_ptr::operator!=(const exception_ptr& lhs,
-                                     const exception_ptr& rhs) throw()
+                                     const exception_ptr& rhs)
+  _GLIBCXX_USE_NOEXCEPT
 { return !(lhs == rhs);}
 
 
 std::exception_ptr
-std::current_exception() throw()
+std::current_exception() _GLIBCXX_USE_NOEXCEPT
 {
   __cxa_eh_globals *globals = __cxa_get_globals ();
   __cxa_exception *header = globals->caughtExceptions;
Index: libsupc++/bad_alloc.cc
===================================================================
--- libsupc++/bad_alloc.cc      (revision 182058)
+++ libsupc++/bad_alloc.cc      (working copy)
@@ -1,6 +1,6 @@
 // Implementation file for the -*- C++ -*- dynamic memory management header.
 
-// Copyright (C) 2010 Free Software Foundation
+// Copyright (C) 2010, 2011 Free Software Foundation
 //
 // This file is part of GCC.
 //
@@ -25,10 +25,10 @@
 
 #include "new"
 
-std::bad_alloc::~bad_alloc() throw() { }
+std::bad_alloc::~bad_alloc() _GLIBCXX_USE_NOEXCEPT { }
 
 const char* 
-std::bad_alloc::what() const throw()
+std::bad_alloc::what() const _GLIBCXX_USE_NOEXCEPT
 {
   return "std::bad_alloc";
 }
Index: libsupc++/nested_exception.h
===================================================================
--- libsupc++/nested_exception.h        (revision 182058)
+++ libsupc++/nested_exception.h        (working copy)
@@ -57,13 +57,13 @@
     exception_ptr _M_ptr;
 
   public:
-    nested_exception() throw() : _M_ptr(current_exception()) { }
+    nested_exception() noexcept : _M_ptr(current_exception()) { }
 
     nested_exception(const nested_exception&) = default;
 
     nested_exception& operator=(const nested_exception&) = default;
 
-    virtual ~nested_exception();
+    virtual ~nested_exception() noexcept;
 
     void
     rethrow_nested() const __attribute__ ((__noreturn__))
Index: libsupc++/exception_ptr.h
===================================================================
--- libsupc++/exception_ptr.h   (revision 182058)
+++ libsupc++/exception_ptr.h   (working copy)
@@ -59,7 +59,7 @@
    *  is none, or the currently handled exception is foreign, return the null
    *  value.
    */
-  exception_ptr current_exception() throw();
+  exception_ptr current_exception() _GLIBCXX_USE_NOEXCEPT;
 
   /// Throw the object pointed to by the exception_ptr.
   void rethrow_exception(exception_ptr) __attribute__ ((__noreturn__));
@@ -74,27 +74,27 @@
     {
       void* _M_exception_object;
 
-      explicit exception_ptr(void* __e) throw();
+      explicit exception_ptr(void* __e) _GLIBCXX_USE_NOEXCEPT;
 
-      void _M_addref() throw();
-      void _M_release() throw();
+      void _M_addref() _GLIBCXX_USE_NOEXCEPT;
+      void _M_release() _GLIBCXX_USE_NOEXCEPT;
 
-      void *_M_get() const throw() __attribute__ ((__pure__));
+      void *_M_get() const _GLIBCXX_NOEXCEPT __attribute__ ((__pure__));
 
-      friend exception_ptr std::current_exception() throw();
+      friend exception_ptr std::current_exception() _GLIBCXX_USE_NOEXCEPT;
       friend void std::rethrow_exception(exception_ptr);
 
     public:
-      exception_ptr() throw();
+      exception_ptr() _GLIBCXX_USE_NOEXCEPT;
 
-      exception_ptr(const exception_ptr&) throw();
+      exception_ptr(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT;
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
-      exception_ptr(nullptr_t) throw()
+      exception_ptr(nullptr_t) noexcept
       : _M_exception_object(0)
       { }
 
-      exception_ptr(exception_ptr&& __o) throw()
+      exception_ptr(exception_ptr&& __o) noexcept
       : _M_exception_object(__o._M_exception_object)
       { __o._M_exception_object = 0; }
 #endif
@@ -103,31 +103,33 @@
       typedef void (exception_ptr::*__safe_bool)();
 
       // For construction from nullptr or 0.
-      exception_ptr(__safe_bool) throw();
+      exception_ptr(__safe_bool) _GLIBCXX_USE_NOEXCEPT;
 #endif
 
       exception_ptr& 
-      operator=(const exception_ptr&) throw();
+      operator=(const exception_ptr&) _GLIBCXX_USE_NOEXCEPT;
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       exception_ptr& 
-      operator=(exception_ptr&& __o) throw()
+      operator=(exception_ptr&& __o) noexcept
       {
         exception_ptr(static_cast<exception_ptr&&>(__o)).swap(*this);
         return *this;
       }
 #endif
 
-      ~exception_ptr() throw();
+      ~exception_ptr() _GLIBCXX_USE_NOEXCEPT;
 
       void 
-      swap(exception_ptr&) throw();
+      swap(exception_ptr&) _GLIBCXX_USE_NOEXCEPT;
 
 #ifdef _GLIBCXX_EH_PTR_COMPAT
       // Retained for compatibility with CXXABI_1.3.
-      void _M_safe_bool_dummy() throw() __attribute__ ((__const__));
-      bool operator!() const throw() __attribute__ ((__pure__));
-      operator __safe_bool() const throw();
+      void _M_safe_bool_dummy() _GLIBCXX_USE_NOEXCEPT
+       __attribute__ ((__const__));
+      bool operator!() const _GLIBCXX_USE_NOEXCEPT
+       __attribute__ ((__pure__));
+      operator __safe_bool() const _GLIBCXX_USE_NOEXCEPT;
 #endif
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
@@ -136,20 +138,21 @@
 #endif
 
       friend bool 
-      operator==(const exception_ptr&, const exception_ptr&) throw() 
-      __attribute__ ((__pure__));
+      operator==(const exception_ptr&, const exception_ptr&)
+       _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
 
       const class type_info*
-      __cxa_exception_type() const throw() __attribute__ ((__pure__));
+      __cxa_exception_type() const _GLIBCXX_USE_NOEXCEPT
+       __attribute__ ((__pure__));
     };
 
     bool 
-    operator==(const exception_ptr&, const exception_ptr&) throw() 
-    __attribute__ ((__pure__));
+    operator==(const exception_ptr&, const exception_ptr&)
+      _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
 
     bool 
-    operator!=(const exception_ptr&, const exception_ptr&) throw() 
-    __attribute__ ((__pure__));
+    operator!=(const exception_ptr&, const exception_ptr&)
+      _GLIBCXX_USE_NOEXCEPT __attribute__ ((__pure__));
 
     inline void
     swap(exception_ptr& __lhs, exception_ptr& __rhs)
@@ -161,7 +164,7 @@
   /// Obtain an exception_ptr pointing to a copy of the supplied object.
   template<typename _Ex>
     exception_ptr 
-    copy_exception(_Ex __ex) throw()
+    copy_exception(_Ex __ex) _GLIBCXX_USE_NOEXCEPT
     {
       __try
        {
@@ -180,7 +183,7 @@
   /// Obtain an exception_ptr pointing to a copy of the supplied object.
   template<typename _Ex>
     exception_ptr 
-    make_exception_ptr(_Ex __ex) throw()
+    make_exception_ptr(_Ex __ex) _GLIBCXX_USE_NOEXCEPT
     { return std::copy_exception<_Ex>(__ex); }
 
   // @} group exceptions
Index: testsuite/18_support/nested_exception/throw_with_nested.cc
===================================================================
--- testsuite/18_support/nested_exception/throw_with_nested.cc  (revision 
182054)
+++ testsuite/18_support/nested_exception/throw_with_nested.cc  (working copy)
@@ -1,7 +1,7 @@
 // { dg-options "-std=gnu++0x" }
 // { dg-require-atomic-builtins "" }
 
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 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
@@ -23,8 +23,8 @@
 
 struct derived : std::nested_exception { };
 
-struct not_derived { virtual ~not_derived(); };
-inline not_derived::~not_derived() = default;
+struct not_derived { virtual ~not_derived() noexcept; };
+inline not_derived::~not_derived() noexcept = default;
 
 void test01() 
 {
Index: testsuite/18_support/nested_exception/51438.cc
===================================================================
--- testsuite/18_support/nested_exception/51438.cc      (revision 0)
+++ testsuite/18_support/nested_exception/51438.cc      (revision 0)
@@ -0,0 +1,33 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+// { dg-require-atomic-builtins "" }
+
+// Copyright (C) 2011 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 <exception>
+#include <stdexcept>
+
+// libstdc++/51438
+void test()
+{
+  try {
+    throw 2;
+  } catch(int) {
+    std::throw_with_nested(std::runtime_error("test"));
+  }
+}
Index: testsuite/18_support/nested_exception/rethrow_if_nested.cc
===================================================================
--- testsuite/18_support/nested_exception/rethrow_if_nested.cc  (revision 
182054)
+++ testsuite/18_support/nested_exception/rethrow_if_nested.cc  (working copy)
@@ -1,7 +1,7 @@
 // { dg-options "-std=gnu++0x" }
 // { dg-require-atomic-builtins "" }
 
-// Copyright (C) 2009 Free Software Foundation, Inc.
+// Copyright (C) 2009, 2010, 2011 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
@@ -23,8 +23,8 @@
 
 struct derived : std::nested_exception { };
 
-struct base { virtual ~base(); };
-inline base::~base() = default;
+struct base { virtual ~base() noexcept; };
+inline base::~base() noexcept = default;
 
 struct derived2 : base, std::nested_exception { };
 

Reply via email to