p3.cpp revision 229f3b3ebd5cee39a2cc81e2f707de5a7e88ddfd
1// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3template<class X, class Y, class Z> X f(Y,Z); // expected-note {{candidate template ignored: couldn't infer template argument 'X'}}
4
5void g() {
6  f<int,char*,double>("aa",3.0); // expected-warning{{conversion from string literal to 'char *' is deprecated}}
7  f<int,char*>("aa",3.0); // Z is deduced to be double  \
8                          // expected-warning{{conversion from string literal to 'char *' is deprecated}}
9  f<int>("aa",3.0);       // Y is deduced to be char*, and
10                          // Z is deduced to be double
11  f("aa",3.0); // expected-error{{no matching}}
12}
13
14// PR5910
15namespace PR5910 {
16  template <typename T>
17  void Func() {}
18
19  template <typename R>
20  void Foo(R (*fp)());
21
22  void Test() {
23    Foo(Func<int>);
24  }
25}
26
27// PR5949
28namespace PR5949 {
29  struct Bar;
30
31  template <class Container>
32  void quuz(const Container &cont) {
33  }
34
35  template<typename T>
36  int Foo(Bar *b, void (*Baz)(const T &t), T * = 0) {
37    return 0;
38  }
39
40  template<typename T>
41  int Quux(Bar *b, T * = 0)
42  {
43    return Foo<T>(b, quuz);
44  }
45}
46
47// PR7641
48namespace PR7641 {
49  namespace N2
50  {
51    template<class>
52    int f0(int);
53  }
54  namespace N
55  {
56    using N2::f0;
57  }
58
59  template<class R,class B1>
60  int
61  f1(R(a)(B1));
62
63  void f2()
64  { f1(N::f0<int>); }
65}
66