#include <typeinfo>
#include <exception>
#include <cstddef>
#include "unwind.h"
#include <testsuite_hooks.h>
struct __cxa_exception
{
std::type_info *exceptionType;
void (*exceptionDestructor)(void *);
std::unexpected_handler unexpectedHandler;
std::terminate_handler terminateHandler;
__cxa_exception *nextException;
int handlerCount;
#ifdef __ARM_EABI_UNWINDER__
__cxa_exception* nextPropagatingException;
int propagationCount;
#else
int handlerSwitchValue;
const unsigned char *actionRecord;
const unsigned char *languageSpecificData;
_Unwind_Ptr catchTemp;
void *adjustedPtr;
#endif
_Unwind_Exception unwindHeader;
};
struct __cxa_eh_globals
{
__cxa_exception *caughtExceptions;
unsigned int uncaughtExceptions;
#ifdef __ARM_EABI_UNWINDER__
__cxa_exception* propagatingExceptions;
#endif
};
extern "C" __cxa_eh_globals *__cxa_get_globals () throw();
void test01 ()
{
bool test __attribute__((unused)) = true;
try {
throw 0;
} catch(...) {
__cxa_exception *exc = __cxa_get_globals()->caughtExceptions;
VERIFY ( exc != NULL );
VERIFY ( typeid(int) == *exc->exceptionType );
}
try {
throw 0LL;
} catch(...) {
__cxa_exception *exc = __cxa_get_globals()->caughtExceptions;
VERIFY ( exc != NULL );
VERIFY ( typeid(long long int) == *exc->exceptionType );
}
try {
throw 0.0;
} catch(...) {
__cxa_exception *exc = __cxa_get_globals()->caughtExceptions;
VERIFY ( exc != NULL );
VERIFY ( typeid(double) == *exc->exceptionType );
}
}
int main ()
{
test01 ();
}