Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / lambda-invalid-capture.cpp
blob236753871d7018b74db0ac178717b8ae7969e8fc
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // Don't crash.
4 struct g {
5 j; // expected-error {{a type specifier is required for all declarations}}
6 };
8 void captures_invalid_type() {
9 g child;
10 auto q = [child]{};
11 const int n = sizeof(q);
14 void captures_invalid_array_type() {
15 g child[100];
16 auto q = [child]{};
17 const int n = sizeof(q);
20 int pr43080(int i) { // expected-note {{declared here}}
21 return [] { // expected-note {{begins here}} expected-note 2 {{capture 'i' by}} expected-note 2 {{default capture by}}
22 return sizeof i <
23 i; // expected-error {{variable 'i' cannot be implicitly captured in a lambda with no capture-default specified}}
24 }();