1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s 2 // expected-no-diagnostics 3 namespace std_example { 4 int i; 5 int f1(); 6 int&& f2(); 7 int &g(const int &); 8 float &g(const int &&); 9 int &j = g(i); 10 float &k = g(f1()); 11 float &l = g(f2()); 12 13 int &g2(const int &); 14 float &g2(int &&); 15 int &j2 = g2(i); 16 float &k2 = g2(f1()); 17 float &l2 = g2(f2()); 18 19 // FIXME: We don't support ref-qualifiers yet. 20 #if 0 21 struct A { 22 A& operator<<(int); 23 void p() &; 24 void p() &&; 25 }; 26 27 A& operator<<(A&&, char); 28 A() << 1; 29 A() << 'c'; 30 A a; 31 a << 1; 32 a << 'c'; 33 A().p(); 34 a.p(); 35 #endif 36 } 37 38 template<typename T> 39 struct remove_reference { 40 typedef T type; 41 }; 42 43 template<typename T> 44 struct remove_reference<T&> { 45 typedef T type; 46 }; 47 48 template<typename T> 49 struct remove_reference<T&&> { 50 typedef T type; 51 }; 52 53 namespace FunctionReferencesOverloading { 54 template<typename T> int &f(typename remove_reference<T>::type&); 55 template<typename T> float &f(typename remove_reference<T>::type&&); 56 57 void test_f(int (&func_ref)(int)) { 58 int &ir = f<int (&)(int)>(func_ref); 59 } 60 } 61