]> git.proxmox.com Git - rustc.git/blame - src/llvm/tools/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp
Imported Upstream version 0.6
[rustc.git] / src / llvm / tools / clang / test / CXX / expr / expr.prim / expr.prim.lambda / p8.cpp
CommitLineData
223e47cc
LB
1// RUN: %clang_cc1 -std=c++11 %s -verify
2
3class X0 {
4 void explicit_capture() {
5 int foo;
6
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-error {{'this' cannot be explicitly captured}}
12 (void)[&, foo] () {};
13 (void)[&, &foo] () {}; // expected-error {{'&' cannot precede a capture when}}
14 (void)[&, this] () {};
15 }
16};
17
18struct S2 {
19 void f(int i);
20 void g(int i);
21};
22
23void S2::f(int i) {
24 (void)[&, i]{ };
25 (void)[&, &i]{ }; // expected-error{{'&' cannot precede a capture when the capture default is '&'}}
26 (void)[=, this]{ }; // expected-error{{'this' cannot be explicitly captured}}
27 (void)[=]{ this->g(i); };
28 (void)[i, i]{ }; // expected-error{{'i' can appear only once in a capture list}}
29}