diff options
| author | Douglas Gregor <dgregor@apple.com> | 2012-02-09 08:52:43 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2012-02-09 08:52:43 +0000 |
| commit | 410d6af9949ba556985c3b0ba5ea186cdecf2e02 (patch) | |
| tree | 334422878ee2b9a05f514f575290ca8cd6cbc93c | |
| parent | 656bc62a73f204286c8dc21fb5ed418b9c39b2fb (diff) | |
| download | bcm5719-llvm-410d6af9949ba556985c3b0ba5ea186cdecf2e02.tar.gz bcm5719-llvm-410d6af9949ba556985c3b0ba5ea186cdecf2e02.zip | |
Restore the appropriate lexical declaration context for a lambda's
function call operator (to the lambda class). This allows us to IRgen
calls to simple (non-capturing) lambdas, e.g.,
[](int i, int j) -> int { return i + j; }(1, 2)
Eli will be providing test cases as he brings up more IRgen.
llvm-svn: 150166
| -rw-r--r-- | clang/lib/Sema/SemaLambda.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaLambda.cpp b/clang/lib/Sema/SemaLambda.cpp index d59018dedc9..6d8e6a1029a 100644 --- a/clang/lib/Sema/SemaLambda.cpp +++ b/clang/lib/Sema/SemaLambda.cpp @@ -351,7 +351,9 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, // C++ [expr.prim.lambda]p7: // The lambda-expression's compound-statement yields the // function-body (8.4) of the function call operator [...]. - ActOnFinishFunctionBody(LSI->CallOperator, Body, /*IsInstantation=*/false); + CXXMethodDecl *CallOperator = LSI->CallOperator; + ActOnFinishFunctionBody(CallOperator, Body, /*IsInstantation=*/false); + CallOperator->setLexicalDeclContext(Class); } if (LambdaExprNeedsCleanups) |

