summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-21 22:51:27 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-21 22:51:27 +0000
commitb8389976b25ef35d49c1e76d3366fe01415dda0b (patch)
tree41191db8851eb11680fe48a1a78b157631d7fa0f /clang/lib
parentebea9aff0da1848d805d367f0c882e1a4188e284 (diff)
downloadbcm5719-llvm-b8389976b25ef35d49c1e76d3366fe01415dda0b.tar.gz
bcm5719-llvm-b8389976b25ef35d49c1e76d3366fe01415dda0b.zip
In the conflict between C++11 [expr.prim.general]p4, which declares
that 'this' can be used in the brace-or-equal-initializer of a non-static data member, and C++11 [expr.prim.lambda]p9, which says that lambda expressions not in block scope can have no captures, side fully with C++11 [expr.prim.general]p4 by allowing 'this' to be captured within these initializers. This seems to be the intent of non-static data member initializers. llvm-svn: 151101
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Parse/ParseExprCXX.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index fecf7b77657..af532de385d 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -870,8 +870,10 @@ ExprResult Parser::ParseLambdaExpressionAfterIntroducer(
// FIXME: Rename BlockScope -> ClosureScope if we decide to continue using
// it.
- ParseScope BodyScope(this, Scope::BlockScope | Scope::FnScope |
- Scope::DeclScope);
+ unsigned ScopeFlags = Scope::BlockScope | Scope::FnScope | Scope::DeclScope;
+ if (getCurScope()->getFlags() & Scope::ThisScope)
+ ScopeFlags |= Scope::ThisScope;
+ ParseScope BodyScope(this, ScopeFlags);
Actions.ActOnStartOfLambdaDefinition(Intro, D, getCurScope());
OpenPOWER on IntegriCloud