diff options
-rw-r--r-- | test/C++Frontend/EH/copy_ctor_throw.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/C++Frontend/EH/copy_ctor_throw.cpp b/test/C++Frontend/EH/copy_ctor_throw.cpp new file mode 100644 index 0000000000..1c50984ad2 --- /dev/null +++ b/test/C++Frontend/EH/copy_ctor_throw.cpp @@ -0,0 +1,25 @@ +/* Test for throwing an exception from the copy ctor of the exception object + * invoked while building an exception. + */ +#include <stdio.h> + +struct foo { + foo() {} + foo(const foo &F) { throw 1; } +}; + +int main() { + try { + foo f; + throw f; + } catch (int i) { + printf("Success!\n"); + return 0; + } catch (foo &f) { + printf("Failure: caught a foo!\n"); + return 1; + } catch (...) { + printf("Failure: caught something else!\n"); + return 1; + } +} |