diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-02-03 23:06:43 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-02-03 23:06:43 +0000 |
commit | cefc7b20fdb97b989163199e0849b4325e9b7804 (patch) | |
tree | fb864521510d5a871548a1fc87b11997cad0c452 /lib/Sema/SemaExprCXX.cpp | |
parent | b942cb24a060435b18fef5b43eb33d77afc0d03a (diff) |
Make explicit captures which cause implicit captures work correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149719 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 3dd271bb8a..b35ea802e5 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -5030,12 +5030,6 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, Diag(Var->getLocation(), diag::note_previous_decl) << C->Id; continue; } - - if (Var->hasAttr<BlocksAttr>()) { - Diag(C->Loc, diag::err_lambda_capture_block) << C->Id; - Diag(Var->getLocation(), diag::note_previous_decl) << C->Id; - continue; - } // C++11 [expr.prim.lambda]p8: // An identifier or this shall not appear more than once in a @@ -5046,13 +5040,10 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, << SourceRange(LSI->getCapture(Var).getLocation()); continue; } - - // FIXME: If this is capture by copy, make sure that we can in fact copy - // the variable. - // FIXME: Unify with normal capture path, so we get all of the necessary - // nested captures. - LSI->AddCapture(Var, /*isBlock*/false, C->Kind == LCK_ByRef, - /*isNested=*/false, C->Loc, 0); + + TryCaptureKind Kind = C->Kind == LCK_ByRef ? TryCapture_ExplicitByRef : + TryCapture_ExplicitByVal; + TryCaptureVar(Var, C->Loc, Kind); } LSI->finishedExplicitCaptures(); |