[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaCXX / for-range-crash.cpp
blobff84e3472b85f163db9941c664704d8c8e4ad6e3
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++17 %s
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
6 error e; // expected-error {{unknown type name}}
8 template <typename>
9 class Bar {
10 Bar<int> *variables_to_modify;
11 foo() { // expected-error {{a type specifier is required for all declarations}}
12 for (auto *c : *variables_to_modify)
13 delete c;
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);
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;