blob: 693e1431ddcab86fbccbe6fccb73922a57d9cc22 [file] [log] [blame]
Douglas Gregor88b22a42011-01-25 16:13:26 +00001// RUN: %clang_cc1 -std=c++0x -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
2
3
4struct Spacer { int x; };
5struct A { double array[2]; };
6struct B : Spacer, A { };
7
8B &getB();
9
10// CHECK: define %struct.A* @_Z4getAv()
11// CHECK: call %struct.B* @_Z4getBv()
12// CHECK-NEXT: bitcast %struct.B*
13// CHECK-NEXT: getelementptr i8*
14// CHECK-NEXT: bitcast i8* {{.*}} to %struct.A*
15// CHECK-NEXT: ret %struct.A*
16A &&getA() { return static_cast<A&&>(getB()); }
17
18int &getIntLValue();
19int &&getIntXValue();
20int getIntPRValue();
21
22// CHECK: define i32* @_Z2f0v()
23// CHECK: call i32* @_Z12getIntLValuev()
24// CHECK-NEXT: ret i32*
25int &&f0() { return static_cast<int&&>(getIntLValue()); }
26
27// CHECK: define i32* @_Z2f1v()
28// CHECK: call i32* @_Z12getIntXValuev()
29// CHECK-NEXT: ret i32*
30int &&f1() { return static_cast<int&&>(getIntXValue()); }
31
32// CHECK: define i32* @_Z2f2v
33// CHECK: call i32 @_Z13getIntPRValuev()
34// CHECK-NEXT: store i32 {{.*}}, i32*
35// CHECK-NEXT: ret i32*
36int &&f2() { return static_cast<int&&>(getIntPRValue()); }