1 // RUN: %clang_cc1 -verify -emit-llvm -o - %s | FileCheck %s
18 // Test reference binding.
23 void f(const _Complex int&);
28 bool& bool_reference_return();
29 int& int_reference_return();
30 _Complex int& complex_int_reference_return();
31 C& aggregate_reference_return();
39 bool_reference_return() = true;
40 a = bool_reference_return();
42 struct { const bool& b; } b = { true };
49 struct { int bitfield : 3; } s = { 3 };
54 __attribute((vector_size(16))) typedef int vec4;
55 f((vec4){1,2,3,4}[0]);
57 int_reference_return() = 10;
58 a = int_reference_return();
60 struct { const int& a; } agg = { 10 };
69 complex_int_reference_return() = 10i;
70 a = complex_int_reference_return();
72 struct { const _Complex int &a; } agg = { 10i };
75 void test_aggregate() {
79 f(aggregate_return());
80 aggregate_reference_return().a = 10;
82 c = aggregate_reference_return();
84 struct { const C& a; } agg = { C() };
87 int& reference_return() {
91 int reference_decl() {
107 void * const & kFoo = foo;
109 struct D : C { D(); ~D(); };
112 // CHECK: call void @_ZN1DD1Ev
129 // CHECK: call void @_ZN1T1BC1Ev
130 // CHECK: call void @_ZN1T1B1fEv
131 // CHECK: call void @_ZN1T1BD1Ev
132 const A& a = B().f();
133 // CHECK: call void @_ZN1T1fEv
135 // CHECK: call void @_ZN1T1AD1Ev
148 struct s1 { struct s0 &s0; };
149 void f0(s1 a) { s1 b = a; }
157 const int &f2() { return 0; }