1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
6 template<typename U> only(U) = delete;
11 auto a = "const char [16]", *p = &a;
13 only<const char [16]> testA = a;
14 only<const char **> testP = p;
19 only<unsigned long long> testB = b;
21 for (auto c = 0; c < 100; ++c) {
28 const auto *v = &x, u = 6;
32 only<const int*> testV = v;
33 only<const int> testU = u;
34 only<double> testY = y;
47 while (auto a = false) {
51 for (; auto a = "test"; ) {
52 only<const char[5]> testA = a;
55 auto *fail1 = 0; // expected-error {{variable 'fail1' with type 'auto *' has incompatible initializer of type 'int'}}
57 // FIXME: due to PR9233, we get the wrong diagnostic here.
58 const auto **fail2(p); // desired-error {{variable 'fail2' with type 'auto const **' has incompatible initializer of type 'int **'}} expected-error {{cannot initialize}}
70 auto (S::*p3)() = &S::f;
71 auto p4 = &S::g; // expected-error {{incompatible initializer of type '<overloaded function type>'}}
72 auto S::*p5 = &S::g; // expected-error {{incompatible initializer of type '<overloaded function type>'}}
73 auto (S::*p6)(int) = &S::g;
77 only<void (S::*)()> test1 = p1;
78 only<void (S::*)()> test2 = p2;
79 only<void (S::*)()> test3 = p3;
80 only<char (S::*)(int)> test6 = p6;
81 only<int (S::*)> test7 = p7;
82 only<int (S::*)> test8 = p8;
86 // TODO: if the initializer is a braced-init-list, deduce auto as std::initializer_list<T>.