[llvm-commits] CVS: llvm/test/Regression/C++Frontend/EH/copy_ctor_throw.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Aug 27 13:21:03 PDT 2003
Changes in directory llvm/test/Regression/C++Frontend/EH:
copy_ctor_throw.cpp added (r1.1)
---
Log message:
New testcase. Unfortunately, native GCC gets this wrong. Someday we will have to figure out how to deal with this.
---
Diffs of the changes:
Index: llvm/test/Regression/C++Frontend/EH/copy_ctor_throw.cpp
diff -c /dev/null llvm/test/Regression/C++Frontend/EH/copy_ctor_throw.cpp:1.1
*** /dev/null Wed Aug 27 13:20:03 2003
--- llvm/test/Regression/C++Frontend/EH/copy_ctor_throw.cpp Wed Aug 27 13:19:53 2003
***************
*** 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;
+ }
+ }
More information about the llvm-commits
mailing list