| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++03 -Wno-c++11-extensions %s |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -verify %s |
| 3 |
// Don't crash. |
| 4 |
|
| 5 |
struct g { |
| 6 |
j; // expected-error {{a type specifier is required for all declarations}} |
| 7 |
}; |
| 8 |
|
| 9 |
void captures_invalid_type() { |
| 10 |
g child; |
| 11 |
auto q = [child]{}; |
| 12 |
const int n = sizeof(q); |
| 13 |
} |
| 14 |
|
| 15 |
void captures_invalid_array_type() { |
| 16 |
g child[100]; |
| 17 |
auto q = [child]{}; |
| 18 |
const int n = sizeof(q); |
| 19 |
} |
| 20 |
|
| 21 |
int pr43080(int i) { // expected-note {{declared here}} |
| 22 |
return [] { // expected-note {{begins here}} expected-note 2 {{capture 'i' by}} expected-note 2 {{default capture by}} |
| 23 |
return sizeof i < |
| 24 |
i; // expected-error {{variable 'i' cannot be implicitly captured in a lambda with no capture-default specified}} |
| 25 |
}(); |
| 26 |
} |