79 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s4 5template<class X, class Y, class Z> X f(Y,Z); // expected-note {{candidate template ignored: couldn't infer template argument 'X'}}6 7void g() {8 f<int,char*,double>("aa",3.0);9#if __cplusplus <= 199711L // C++03 or earlier modes10 // expected-warning@-2{{conversion from string literal to 'char *' is deprecated}}11#else12 // expected-warning@-4{{ISO C++11 does not allow conversion from string literal to 'char *'}}13#endif14 15 f<int,char*>("aa",3.0); // Z is deduced to be double16#if __cplusplus <= 199711L17 // expected-warning@-2{{conversion from string literal to 'char *' is deprecated}}18#else19 // expected-warning@-4{{ISO C++11 does not allow conversion from string literal to 'char *'}}20#endif21 22 f<int>("aa",3.0); // Y is deduced to be char*, and23 // Z is deduced to be double 24 f("aa",3.0); // expected-error{{no matching}}25}26 27// PR591028namespace PR5910 {29 template <typename T>30 void Func() {}31 32 template <typename R>33 void Foo(R (*fp)());34 35 void Test() {36 Foo(Func<int>);37 }38}39 40// PR594941namespace PR5949 {42 struct Bar;43 44 template <class Container>45 void quuz(const Container &cont) {46 }47 48 template<typename T>49 int Foo(Bar *b, void (*Baz)(const T &t), T * = 0) {50 return 0;51 }52 53 template<typename T>54 int Quux(Bar *b, T * = 0)55 {56 return Foo<T>(b, quuz);57 }58}59 60// PR764161namespace PR7641 {62 namespace N263 {64 template<class>65 int f0(int);66 }67 namespace N68 {69 using N2::f0;70 }71 72 template<class R,class B1>73 int74 f1(R(a)(B1));75 76 void f2()77 { f1(N::f0<int>); }78}79