OSDN Git Service

PR libstdc++/10606
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / libsupc++ / eh_alloc.cc
index 4728bcb..3b7319e 100644 (file)
@@ -147,6 +147,12 @@ __cxxabiv1::__cxa_allocate_exception(std::size_t thrown_size) throw()
        std::terminate ();
     }
 
+  // We have an uncaught exception as soon as we allocate memory.  This
+  // yields uncaught_exception() true during the copy-constructor that
+  // initializes the exception object.  See Issue 475.
+  __cxa_eh_globals *globals = __cxa_get_globals ();
+  globals->uncaughtExceptions += 1;
+
   memset (ret, 0, sizeof (__cxa_exception));
 
   return (void *)((char *)ret + sizeof (__cxa_exception));