[multiple changes]
[gcc.git] / libstdc++-v3 / libsupc++ / eh_type.cc
index 99627efdd9768362d14cd326b0a835f6e4a73e9a..034329767142ccd50b387a6e8b8033ecd6eb1ed4 100644 (file)
@@ -1,5 +1,5 @@
 // -*- C++ -*- Exception handling routines for catching.
-// Copyright (C) 2001 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2008 Free Software Foundation, Inc.
 //
 // This file is part of GCC.
 //
@@ -43,7 +43,15 @@ std::type_info *__cxa_current_exception_type ()
   __cxa_eh_globals *globals = __cxa_get_globals ();
   __cxa_exception *header = globals->caughtExceptions;
   if (header)
-    return header->exceptionType;
+    {
+      if (__is_dependent_exception (header->unwindHeader.exception_class))
+        {
+          __cxa_dependent_exception *de =
+            __get_dependent_exception_from_ue (&header->unwindHeader);
+          header = __get_exception_header_from_obj (de->primaryException);
+        }
+      return header->exceptionType;
+    }
   else
     return 0;
 }