references.cpp revision 4bbab92167713bf4f79c0b14dcc4e83d08ac4019
1// RUN: clang-cc -verify -emit-llvm -o %t %s
2
3void t1() {
4  extern int& a;
5  int b = a;
6}
7
8void t2(int& a) {
9  int b = a;
10}
11
12int g;
13int& gr = g;
14void t3() {
15  int b = gr;
16}
17
18// Test reference binding.
19
20struct C {};
21
22void f(const int&);
23void f(const _Complex int&);
24void f(const C&);
25
26void test_scalar() {
27  int a = 10;
28
29  f(a);
30}
31
32void test_complex() {
33  _Complex int a = 10i;
34
35  f(a);
36}
37
38void test_aggregate() {
39  C c;
40
41  f(c);
42}
43
44