summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/lambda-expressions.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-01 01:18:43 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-01 01:18:43 +0000
commit53a9bdf17ee753b4797b3005808ac6bc1184ad8f (patch)
treedb183b92bdff1461a88de873c87a63b04f76ec81 /clang/test/SemaCXX/lambda-expressions.cpp
parent8680c713a63062fd1463a1ef5dbeed7f49d22e09 (diff)
downloadbcm5719-llvm-53a9bdf17ee753b4797b3005808ac6bc1184ad8f.tar.gz
bcm5719-llvm-53a9bdf17ee753b4797b3005808ac6bc1184ad8f.zip
Improve checking of explicit captures in a C++11 lambda expression:
- Actually building the var -> capture mapping properly (there was an off-by-one error) - Keeping track of the source location of each capture - Minor QoI improvements, e.g, highlighing the prior capture if there are multiple captures, pointing at the variable declaration we found if we reject it. As part of this, add standard citations for the various semantic checks we perform, and note where we're not performing those checks as we should. llvm-svn: 149462
Diffstat (limited to 'clang/test/SemaCXX/lambda-expressions.cpp')
-rw-r--r--clang/test/SemaCXX/lambda-expressions.cpp30
1 files changed, 3 insertions, 27 deletions
diff --git a/clang/test/SemaCXX/lambda-expressions.cpp b/clang/test/SemaCXX/lambda-expressions.cpp
index 0223b50755e..cacd4b680ce 100644
--- a/clang/test/SemaCXX/lambda-expressions.cpp
+++ b/clang/test/SemaCXX/lambda-expressions.cpp
@@ -3,14 +3,6 @@
namespace std { class type_info; };
namespace ExplicitCapture {
- int GlobalVar; // expected-note {{declared here}}
-
- namespace N {
- int AmbiguousVar; // expected-note {{candidate}}
- }
- int AmbiguousVar; // expected-note {{candidate}}
- using namespace N;
-
class C {
int Member;
@@ -18,28 +10,12 @@ namespace ExplicitCapture {
void Overload();
virtual C& Overload(float);
- void ExplicitCapture() {
- int foo;
-
- [foo, foo] () {}; // expected-error {{'foo' can appear only once}} expected-error {{not supported yet}}
- [this, this] () {}; // expected-error {{'this' can appear only once}} expected-error {{not supported yet}}
- [=, foo] () {}; // expected-error {{'&' must precede a capture when}} expected-error {{not supported yet}}
- [=, &foo] () {}; // expected-error {{not supported yet}}
- [=, this] () {}; // expected-error {{'this' cannot appear}} expected-error {{not supported yet}}
- [&, foo] () {}; // expected-error {{not supported yet}}
- [&, &foo] () {}; // expected-error {{'&' cannot precede a capture when}} expected-error {{not supported yet}}
- [&, this] () {}; // expected-error {{not supported yet}}
- [&Overload] () {}; // expected-error {{does not name a variable}} expected-error {{not supported yet}}
- [&GlobalVar] () {}; // expected-error {{does not have automatic storage duration}} expected-error {{not supported yet}}
- [&AmbiguousVar] () {} // expected-error {{reference to 'AmbiguousVar' is ambiguous}} expected-error {{not supported yet}}
- [&Globalvar] () {}; // expected-error {{use of undeclared identifier 'Globalvar'; did you mean 'GlobalVar}}
- }
-
void ImplicitThisCapture() {
[](){(void)Member;}; // expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}}
[&](){(void)Member;}; // expected-error {{not supported yet}}
- [this](){(void)Member;}; // expected-error {{not supported yet}}
- [this]{[this]{};};// expected-error 2 {{not supported yet}}
+ // FIXME: 'this' captures below don't actually work yet
+ // FIXME: [this](){(void)Member;};
+ // FIXME: [this]{[this]{};};
[]{[this]{};};// expected-error {{'this' cannot be implicitly captured in this context}} expected-error 2 {{not supported yet}}
[]{Overload(3);}; // expected-error {{not supported yet}}
[]{Overload();}; // expected-error {{'this' cannot be implicitly captured in this context}} expected-error {{not supported yet}}
OpenPOWER on IntegriCloud