1 // RUN: %clang_cc1 -fsyntax-only -verify -fborland-extensions -fcxx-exceptions %s
3 // This test is from http://docwiki.embarcadero.com/RADStudio/en/Try
5 int puts(const char *);
8 int printf(const char *, T);
10 const char * strdup(const char *);
12 void free(const void *);
14 #define EXCEPTION_EXECUTE_HANDLER 1
19 Exception(const char* s = "Unknown"){what = strdup(s); }
20 Exception(const Exception& e ){what = strdup(e.what); }
21 ~Exception() {free(what); }
22 const char* msg() const {return what; }
38 puts("Another exception:");
42 __except(EXCEPTION_EXECUTE_HANDLER)
44 puts("Caught a C-based exception.");
45 throw(Exception("Hardware error: Divide by 0"));
48 catch(const Exception& e)
50 printf("Caught C++ Exception: %s :\n", e.msg());
55 puts("C++ allows __finally too!");