Anders Carlsson | c8667a8 | 2009-05-19 20:40:02 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -verify -emit-llvm -o %t %s |
2 | |||||
3 | void t1() { | ||||
4 | extern int& a; | ||||
5 | int b = a; | ||||
6 | } | ||||
7 | |||||
8 | void t2(int& a) { | ||||
9 | int b = a; | ||||
10 | } | ||||
11 | |||||
12 | int g; | ||||
13 | int& gr = g; | ||||
14 | void t3() { | ||||
15 | int b = gr; | ||||
16 | } | ||||
Anders Carlsson | 4bbab92 | 2009-05-20 00:36:58 +0000 | [diff] [blame^] | 17 | |
18 | // Test reference binding. | ||||
19 | |||||
20 | struct C {}; | ||||
21 | |||||
22 | void f(const int&); | ||||
23 | void f(const _Complex int&); | ||||
24 | void f(const C&); | ||||
25 | |||||
26 | void test_scalar() { | ||||
27 | int a = 10; | ||||
28 | |||||
29 | f(a); | ||||
30 | } | ||||
31 | |||||
32 | void test_complex() { | ||||
33 | _Complex int a = 10i; | ||||
34 | |||||
35 | f(a); | ||||
36 | } | ||||
37 | |||||
38 | void test_aggregate() { | ||||
39 | C c; | ||||
40 | |||||
41 | f(c); | ||||
42 | } | ||||
43 |