1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
2 
3 template<typename T>
4 struct only {
5   only(T);
6   template<typename U> only(U) = delete; // expected-note {{here}}
7 };
8 
9 template<typename ...T>
f(T...t)10 void f(T ...t) {
11   auto x(t...); // expected-error {{is empty}} expected-error {{contains multiple expressions}}
12   only<int> check = x;
13 }
14 
g()15 void g() {
16   f(); // expected-note {{here}}
17   f(0);
18   f(0, 1); // expected-note {{here}}
19 }
20 
21 
22 template<typename T>
h(T t)23 bool h(T t) {
24   auto a = t;
25   decltype(a) b;
26   a = a + b;
27 
28   auto p = new auto(t);
29 
30   only<double*> test = p; // expected-error {{conversion function from 'char *' to 'only<double *>'}}
31   return p;
32 }
33 
34 bool b = h('x'); // expected-note {{here}}
35 
36 // PR 9276 - Make sure we check auto types deduce the same
37 // in the case of a dependent initializer
38 namespace PR9276 {
39   template<typename T>
f()40   void f() {
41     auto i = T(), j = 0; // expected-error {{deduced as 'long' in declaration of 'i' and deduced as 'int' in declaration of 'j'}}
42   }
43 
g()44   void g() {
45     f<long>(); // expected-note {{here}}
46     f<int>();
47   }
48 }
49 
50 namespace NoRepeatedDiagnostic {
51   template<typename T>
f()52   void f() {
53     auto a = 0, b = 0.0, c = T(); // expected-error {{deduced as 'int' in declaration of 'a' and deduced as 'double' in declaration of 'b'}}
54   }
55   // We've already diagnosed an issue. No extra diagnostics is needed for these.
56   template void f<int>();
57   template void f<double>();
58   template void f<char>();
59 }
60