1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 2 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wno-c++11-extensions 3 4 template<typename T> 5 struct only { 6 only(T); 7 template<typename U> only(U) = delete; 8 }; 9 10 void f() { 11 if (auto a = true) { 12 } 13 14 switch (auto a = 0) { 15 } 16 17 while (auto a = false) { 18 } 19 20 for (; auto a = false; ) { 21 } 22 23 new const auto (0); 24 new (auto) (0.0); 25 26 int arr[] = {1, 2, 3}; 27 for (auto i : arr) { 28 } 29 } 30 31 class X { 32 static const auto n = 'x'; 33 34 auto m = 0; // expected-error {{'auto' not allowed in non-static class member}} 35 }; 36 37 struct S { 38 static const auto a; // expected-error {{declaration of variable 'a' with type 'auto const' requires an initializer}} 39 static const auto b = 0; 40 static const int c; 41 }; 42 const int S::b; 43 const auto S::c = 0; 44