1 // RUN: %clang_cc1 -std=c++11 %s -verify -Wno-c++14-extensions
4 void explicit_capture() {
7 (void)[foo
, foo
] () {}; // expected-error {{'foo' can appear only once}}
8 (void)[this, this] () {}; // expected-error {{'this' can appear only once}}
9 (void)[=, foo
] () {}; // expected-error {{'&' must precede a capture when}}
10 (void)[=, &foo
] () {};
11 (void)[=, this] () {}; // expected-warning {{C++20 extension}}
13 (void)[&, &foo
] () {}; // expected-error {{'&' cannot precede a capture when}}
14 (void)[&, this] () {};
25 (void)[&, &i
]{ }; // expected-error{{'&' cannot precede a capture when the capture default is '&'}}
26 (void)[=, this]{ }; // expected-warning{{C++20 extension}}
27 (void)[=]{ this->g(i
); };
28 (void)[i
, i
]{ }; // expected-error{{'i' can appear only once in a capture list}}
29 (void)[i(0), i(1)]{ }; // expected-error{{'i' can appear only once in a capture list}}
30 (void)[i
, i(1)]{ }; // expected-error{{'i' can appear only once in a capture list}}
31 (void)[i(0), i
]{ }; // expected-error{{'i' can appear only once in a capture list}}