1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s
2 
3 // Ensure that we don't crash if errors are suppressed by an error limit.
4 // RUN: not %clang_cc1 -fsyntax-only -std=c++17 -ferror-limit=1 %s
5 
6 error e; // expected-error {{unknown type name}}
7 
8 template <typename>
9 class Bar {
10   Bar<int> *variables_to_modify;
foo()11   foo() { // expected-error {{C++ requires a type specifier for all declarations}}
12     for (auto *c : *variables_to_modify)
13       delete c;
14   }
15 };
16 
foo()17 void foo() {
18   int a;
19   struct X; // expected-note {{forward declaration}}
20   for (X x // expected-error {{incomplete type}}
21       : a) { // expected-error {{range expression of type 'int'}}
22     constexpr int n = sizeof(x);
23   }
24 
25   struct S { int x, y; };
26   for (S [x, y] // expected-error {{must be 'auto'}}
27       : a) { // expected-error {{range expression}}
28     typename decltype(x)::a b;
29   }
30 }
31