[llvm-commits] CVS: llvm/test/Programs/SingleSource/Regression/C++/EH/ctor_dtor_count-2.cpp

Chris Lattner lattner at cs.uiuc.edu
Fri Oct 10 11:07:01 PDT 2003


Changes in directory llvm/test/Programs/SingleSource/Regression/C++/EH:

ctor_dtor_count-2.cpp added (r1.1)

---
Log message:

Checkin testcase for PR#27


---
Diffs of the changes:  (+36 -0)

Index: llvm/test/Programs/SingleSource/Regression/C++/EH/ctor_dtor_count-2.cpp
diff -c /dev/null llvm/test/Programs/SingleSource/Regression/C++/EH/ctor_dtor_count-2.cpp:1.1
*** /dev/null	Fri Oct 10 11:06:30 2003
--- llvm/test/Programs/SingleSource/Regression/C++/EH/ctor_dtor_count-2.cpp	Fri Oct 10 11:06:20 2003
***************
*** 0 ****
--- 1,36 ----
+ // Testcase for proper handling of
+ // c++ type, constructors and destructors.
+ 
+ #include <stdio.h>
+ 
+ int c, d;
+ 
+ struct A
+ {
+   int i;
+   A () { i = ++c; printf ("A() %d\n", i); }
+   A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
+   ~A() { printf ("~A() %d\n", i); ++d; }
+ };
+ 
+ void
+ f()
+ {
+   printf ("Throwing 1...\n");
+   throw A();
+ }
+ 
+ 
+ int main() {
+   try
+     {
+       f();
+     }
+   catch (A)
+     {
+       printf ("Caught.\n");
+     }
+   printf ("c == %d, d == %d\n", c, d);
+   return c != d;
+ }
+ 





More information about the llvm-commits mailing list