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

Chris Lattner lattner at cs.uiuc.edu
Tue Nov 25 20:43:01 PST 2003


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

ConditionalExpr.cpp added (r1.1)

---
Log message:

Testcase for PR124



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

Index: llvm/test/Programs/SingleSource/Regression/C++/EH/ConditionalExpr.cpp
diff -c /dev/null llvm/test/Programs/SingleSource/Regression/C++/EH/ConditionalExpr.cpp:1.1
*** /dev/null	Tue Nov 25 20:42:51 2003
--- llvm/test/Programs/SingleSource/Regression/C++/EH/ConditionalExpr.cpp	Tue Nov 25 20:42:41 2003
***************
*** 0 ****
--- 1,27 ----
+ #include <stdio.h>
+ 
+ static int X = 0;
+ 
+ struct T {
+   int V;
+   T() : V(++X) { printf("Construct %d\n", V); }
+   T(const T &) : V(++X) { printf("Copy Construct %d\n", V); }
+   ~T() { printf("Destruct %d\n", V); }
+ 
+   void operator=(const T &t) {
+     printf("Overwrite %d with %d\n", V, t.V);
+     V = t.V;
+   }
+ };
+ 
+ T func(const T &t) { return T(); }
+ 
+ T test(bool C) {
+   return C ? T() : func(T());
+ }
+ 
+ int main() {
+   T x;
+   x = test(true);
+   return 0;
+ }





More information about the llvm-commits mailing list