1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s 2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s 3 4 template<class T> struct A { A(); }; 5 template<class T> int &f(T); 6 template<class T> float &f(T*); 7 template<class T> double &f(const T*); 8 9 template<class T> void g(T); // expected-note{{candidate}} 10 template<class T> void g(T&); // expected-note{{candidate}} 11 12 template<class T> int &h(const T&); 13 template<class T> float &h(A<T>&); 14 15 void m() { 16 const int *p; 17 double &dr1 = f(p); 18 float x; 19 g(x); // expected-error{{ambiguous}} 20 A<int> z; 21 float &fr1 = h(z); 22 const A<int> z2; 23 int &ir1 = h(z2); 24 } 25 26 27 namespace core_26909 { 28 template<typename T> struct A {}; 29 template<typename T, typename U> void f(T&, U); // expected-note {{candidate}} 30 template<typename T, typename U> void f(T&&, A<U>); // expected-note {{candidate}} expected-warning 0-1{{extension}} 31 template<typename T, typename U> void g(const T&, U); // expected-note {{candidate}} 32 template<typename T, typename U> void g(T&, A<U>); // expected-note {{candidate}} 33 34 void h(int a, const char b, A<int> c) { 35 f(a, c); // expected-error{{ambiguous}} 36 g(b, c); // expected-error{{ambiguous}} 37 } 38 } 39 40 namespace PR22435 { 41 template<typename T, typename U> void foo(void (*)(T), const U &); // expected-note {{candidate}} 42 template<typename T, typename U> bool foo(void (*)(T &), U &); // expected-note {{candidate}} 43 void bar(const int x) { bool b = foo<char>(0, x); } // expected-error {{ambiguous}} 44 } 45