diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-02-10 17:46:20 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-02-10 17:46:20 +0000 |
commit | 3ac109cd17151bb8ad3a40b0cbb0e1923cd6c4a0 (patch) | |
tree | 914a4d80e3d45b83bfcf9045f4ceb45b9125dae3 /lib/Sema/SemaExprCXX.cpp | |
parent | 67b2c554dc12f589471713b7b01e9c94257ae593 (diff) |
Allow implicit capture of 'this' in a lambda even when the capture
default is '=', and reword the warning about explicitly capturing
'this' in such lambdas to indicate that only explicit capture is
banned.
Introduce Fix-Its for this and other "save the programmer from
themself" rules regarding what can be explicitly captured and what
must be implicitly captured.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150256 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 63fd869e7b..5a2a827230 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -686,11 +686,10 @@ void Sema::CheckCXXThisCapture(SourceLocation Loc, bool Explicit) { } if (CSI->ImpCaptureStyle == CapturingScopeInfo::ImpCap_LambdaByref || + CSI->ImpCaptureStyle == CapturingScopeInfo::ImpCap_LambdaByval || CSI->ImpCaptureStyle == CapturingScopeInfo::ImpCap_Block || Explicit) { // This closure can capture 'this'; continue looking upwards. - // FIXME: Is this check correct? The rules in the standard are a bit - // unclear. NumClosures++; Explicit = false; continue; |