summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-11-20 17:27:56 +0000
committerAnders Carlsson <andersca@mac.com>2009-11-20 17:27:56 +0000
commit0a66c2619104c7e9f9a0db15f151d1a03a648142 (patch)
tree03215020c717d2c4662419cbaf361bea38aa573c /clang/test/CodeGenCXX
parent9c7efbb996e7513fa0d8d59f0cc993f4fe55fe95 (diff)
downloadbcm5719-llvm-0a66c2619104c7e9f9a0db15f151d1a03a648142.tar.gz
bcm5719-llvm-0a66c2619104c7e9f9a0db15f151d1a03a648142.zip
Fix lifetime of conditional temporaries. Patch by Victor Zverovich!
llvm-svn: 89467
Diffstat (limited to 'clang/test/CodeGenCXX')
-rw-r--r--clang/test/CodeGenCXX/conditional-temporaries.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/conditional-temporaries.cpp b/clang/test/CodeGenCXX/conditional-temporaries.cpp
new file mode 100644
index 00000000000..f6c466a9313
--- /dev/null
+++ b/clang/test/CodeGenCXX/conditional-temporaries.cpp
@@ -0,0 +1,28 @@
+// RUN: clang-cc -emit-llvm %s -o - -triple=x86_64-apple-darwin9 | FileCheck %s
+
+struct I {
+ int i;
+ I();
+ ~I();
+};
+
+void g(int);
+
+volatile int i;
+
+void f1() {
+ // CHECK: call void @_ZN1IC1Ev
+ g(i ? I().i : 0);
+ // CHECK: call void @_Z1gi
+ // CHECK: call void @_ZN1ID1Ev
+
+ // CHECK: call void @_ZN1IC1Ev
+ g(i || I().i);
+ // CHECK: call void @_Z1gi
+ // CHECK: call void @_ZN1ID1Ev
+
+ // CHECK: call void @_ZN1IC1Ev
+ g(i && I().i);
+ // CHECK: call void @_Z1gi
+ // CHECK: call void @_ZN1ID1Ev
+}
OpenPOWER on IntegriCloud