1// RUN: %clang_cc1 -fsyntax-only -verify %s
2// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
4
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 modes
10  // expected-warning@-2{{conversion from string literal to 'char *' is deprecated}}
11#else
12  // expected-warning@-4{{ISO C++11 does not allow conversion from string literal to 'char *'}}
13#endif
14
15  f<int,char*>("aa",3.0); // Z is deduced to be double
16#if __cplusplus <= 199711L
17  // expected-warning@-2{{conversion from string literal to 'char *' is deprecated}}
18#else
19  // expected-warning@-4{{ISO C++11 does not allow conversion from string literal to 'char *'}}
20#endif
21
22  f<int>("aa",3.0);       // Y is deduced to be char*, and
23                          // Z is deduced to be double
24  f("aa",3.0); // expected-error{{no matching}}
25}
26
27// PR5910
28namespace 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// PR5949
41namespace 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// PR7641
61namespace PR7641 {
62  namespace N2
63  {
64    template<class>
65    int f0(int);
66  }
67  namespace N
68  {
69    using N2::f0;
70  }
71
72  template<class R,class B1>
73  int
74  f1(R(a)(B1));
75
76  void f2()
77  { f1(N::f0<int>); }
78}
79