blob: cacd4b680ce9274311d89a6e18c2fd0418cdab2e [file] [log] [blame]
Eli Friedmane81d7e92012-01-07 01:08:17 +00001// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
2
Eli Friedman72899c32012-01-07 04:59:52 +00003namespace std { class type_info; };
4
Eli Friedmane81d7e92012-01-07 01:08:17 +00005namespace ExplicitCapture {
Eli Friedmane81d7e92012-01-07 01:08:17 +00006 class C {
Eli Friedman72899c32012-01-07 04:59:52 +00007 int Member;
Eli Friedmane81d7e92012-01-07 01:08:17 +00008
Eli Friedman72899c32012-01-07 04:59:52 +00009 static void Overload(int);
10 void Overload();
11 virtual C& Overload(float);
12
Eli Friedman72899c32012-01-07 04:59:52 +000013 void ImplicitThisCapture() {
14 [](){(void)Member;}; // expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}}
15 [&](){(void)Member;}; // expected-error {{not supported yet}}
Douglas Gregor93962e52012-02-01 01:18:43 +000016 // FIXME: 'this' captures below don't actually work yet
17 // FIXME: [this](){(void)Member;};
18 // FIXME: [this]{[this]{};};
Eli Friedman72899c32012-01-07 04:59:52 +000019 []{[this]{};};// expected-error {{'this' cannot be implicitly captured in this context}} expected-error 2 {{not supported yet}}
20 []{Overload(3);}; // expected-error {{not supported yet}}
21 []{Overload();}; // expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}}
22 []{(void)typeid(Overload());};// expected-error {{not supported yet}}
23 []{(void)typeid(Overload(.5f));};// expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}}
24 }
Eli Friedmane81d7e92012-01-07 01:08:17 +000025 };
26
27 void f() {
28 [this] () {}; // expected-error {{invalid use of 'this'}} expected-error {{not supported yet}}
29 }
30}
Eli Friedman84b007f2012-01-26 03:00:14 +000031
32namespace ReturnDeduction {
33 void test() {
34 [](){ return 1; }; // expected-error {{not supported yet}}
35 [](){ return 1; }; // expected-error {{not supported yet}}
36 [](){ return ({return 1; 1;}); }; // expected-error {{not supported yet}}
37 [](){ return ({return 'c'; 1;}); }; // expected-error {{not supported yet}} expected-error {{must match previous return type}}
38 []()->int{ return 'c'; return 1; }; // expected-error {{not supported yet}}
39 [](){ return 'c'; return 1; }; // expected-error {{not supported yet}} expected-error {{must match previous return type}}
Eli Friedmane41b0412012-01-26 03:16:41 +000040 []() { return; return (void)0; }; // expected-error {{not supported yet}}
Eli Friedman84b007f2012-01-26 03:00:14 +000041 // FIXME: Need to check structure of lambda body
42 [](){ return 1; return 1; }; // expected-error {{not supported yet}}
43 }
44}