summaryrefslogtreecommitdiffstats
path: root/test/Parser/objcxx0x-lambda-expressions.mm
blob: fb90b16a971f15cc7048b7a730c1ba0c4b15efe5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-value -std=c++11 %s

class C {

  void f() {
    int foo, bar;

    // fail to parse as a lambda introducer, so we get objc message parsing errors instead
    [foo,+] {}; // expected-error {{expected expression}}

    []; // expected-error {{expected body of lambda expression}}
    [=,foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}}
    [&this] {}; // expected-error {{cannot take the address of an rvalue of type 'C *'}}
    [] {}; 
    [=] (int i) {}; 
    [&] (int) mutable -> void {}; 
    [foo,bar] () { return 3; }; 
    [=,&foo] () {}; 
    [this] () {}; 
  }

};

OpenPOWER on IntegriCloud