aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-26 02:42:41 +0000
committerChris Lattner <sabre@nondot.org>2003-11-26 02:42:41 +0000
commitdab9286ea8b7fd06767ba02a45357e4cd0aaaf0e (patch)
tree42eb9a9676974acdc431c86268d92c63bb2830c1
parent6a47ee8a5495084502eaec83972c8f78d7de3e45 (diff)
Testcase for PR124
git-svn-id: https://llvm.org/svn/llvm-project/test-suite/trunk@10234 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--SingleSource/Regression/C++/EH/ConditionalExpr.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/SingleSource/Regression/C++/EH/ConditionalExpr.cpp b/SingleSource/Regression/C++/EH/ConditionalExpr.cpp
new file mode 100644
index 00000000..f110beba
--- /dev/null
+++ b/SingleSource/Regression/C++/EH/ConditionalExpr.cpp
@@ -0,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;
+}