aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-25 16:13:26 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-25 16:13:26 +0000
commit88b22a432549e315662f96abe148923c921970cb (patch)
treef767254903d852303a7e301ec7ad98ca5d9a02bb /test/CodeGenCXX
parent630b7aefc887c19e1f7a102098b4fa7907ae6b75 (diff)
When performing a glvalue-to-xvalue static_cast that involves a
derived-to-base conversion, set the cast kind and base path appropriately. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124189 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX')
-rw-r--r--test/CodeGenCXX/rvalue-references.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/CodeGenCXX/rvalue-references.cpp b/test/CodeGenCXX/rvalue-references.cpp
new file mode 100644
index 0000000000..693e1431dd
--- /dev/null
+++ b/test/CodeGenCXX/rvalue-references.cpp
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
+
+
+struct Spacer { int x; };
+struct A { double array[2]; };
+struct B : Spacer, A { };
+
+B &getB();
+
+// CHECK: define %struct.A* @_Z4getAv()
+// CHECK: call %struct.B* @_Z4getBv()
+// CHECK-NEXT: bitcast %struct.B*
+// CHECK-NEXT: getelementptr i8*
+// CHECK-NEXT: bitcast i8* {{.*}} to %struct.A*
+// CHECK-NEXT: ret %struct.A*
+A &&getA() { return static_cast<A&&>(getB()); }
+
+int &getIntLValue();
+int &&getIntXValue();
+int getIntPRValue();
+
+// CHECK: define i32* @_Z2f0v()
+// CHECK: call i32* @_Z12getIntLValuev()
+// CHECK-NEXT: ret i32*
+int &&f0() { return static_cast<int&&>(getIntLValue()); }
+
+// CHECK: define i32* @_Z2f1v()
+// CHECK: call i32* @_Z12getIntXValuev()
+// CHECK-NEXT: ret i32*
+int &&f1() { return static_cast<int&&>(getIntXValue()); }
+
+// CHECK: define i32* @_Z2f2v
+// CHECK: call i32 @_Z13getIntPRValuev()
+// CHECK-NEXT: store i32 {{.*}}, i32*
+// CHECK-NEXT: ret i32*
+int &&f2() { return static_cast<int&&>(getIntPRValue()); }