references.cpp revision e04d1c77ae15a6e973e2fac7723f6c364884f58d
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 bool&); 23void f(const int&); 24void f(const _Complex int&); 25void f(const C&); 26 27void test_bool() { 28 bool a = true; 29 f(a); 30 31 f(true); 32} 33 34void test_scalar() { 35 int a = 10; 36 f(a); 37 38 f(10); 39} 40 41void test_complex() { 42 _Complex int a = 10i; 43 f(a); 44} 45 46void test_aggregate() { 47 C c; 48 f(c); 49} 50 51