summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/lambda-expressions.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-02-03 23:06:43 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-02-03 23:06:43 +0000
commita023e0c619b340e91ff6c9a53e6945e3ae23dccd (patch)
tree8e41a0d5a3b8613dd0012211e612013d2b29413d /clang/test/SemaCXX/lambda-expressions.cpp
parent24af85047046f23f1f4cb18a7bdf7240490b921e (diff)
downloadbcm5719-llvm-a023e0c619b340e91ff6c9a53e6945e3ae23dccd.tar.gz
bcm5719-llvm-a023e0c619b340e91ff6c9a53e6945e3ae23dccd.zip
Make explicit captures which cause implicit captures work correctly.
llvm-svn: 149719
Diffstat (limited to 'clang/test/SemaCXX/lambda-expressions.cpp')
-rw-r--r--clang/test/SemaCXX/lambda-expressions.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/lambda-expressions.cpp b/clang/test/SemaCXX/lambda-expressions.cpp
index 0f7d5484a8a..05aba53dbba 100644
--- a/clang/test/SemaCXX/lambda-expressions.cpp
+++ b/clang/test/SemaCXX/lambda-expressions.cpp
@@ -45,7 +45,7 @@ namespace ReturnDeduction {
namespace ImplicitCapture {
void test() {
- int a = 0; // expected-note 3 {{declared}}
+ int a = 0; // expected-note 5 {{declared}}
[]() { return a; }; // expected-error {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{begins here}} expected-error {{not supported yet}}
[&]() { return a; }; // expected-error {{not supported yet}}
[=]() { return a; }; // expected-error {{not supported yet}}
@@ -53,6 +53,8 @@ namespace ImplicitCapture {
[=]() { return [&]() { return a; }; }; // expected-error 2 {{not supported yet}}
[]() { return [&]() { return a; }; }; // expected-error {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} expected-error 2 {{not supported yet}}
[]() { return ^{ return a; }; };// expected-error {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} expected-error {{not supported yet}}
+ []() { return [&a] { return a; }; }; // expected-error 2 {{variable 'a' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note 2 {{lambda expression begins here}} expected-error 2 {{not supported yet}}
+ [=]() { return [&a] { return a; }; }; // expected-error 2 {{not supported yet}}
const int b = 2;
[]() { return b; }; // expected-error {{not supported yet}}
@@ -64,8 +66,9 @@ namespace ImplicitCapture {
d = 3;
[=]() { return c; }; // expected-error {{unnamed variable cannot be implicitly captured in a lambda expression}} expected-error {{not supported yet}}
- __block int e; // expected-note {{declared}}
+ __block int e; // expected-note 3 {{declared}}
[&]() { return e; }; // expected-error {{__block variable 'e' cannot be captured in a lambda expression}} expected-error {{not supported yet}}
+ [&e]() { return e; }; // expected-error 2 {{__block variable 'e' cannot be captured in a lambda expression}} expected-error {{not supported yet}}
int f[10]; // expected-note {{declared}}
[&]() { return f[2]; }; // expected-error {{not supported yet}}
OpenPOWER on IntegriCloud