aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaLambda.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-09 08:52:43 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-09 08:52:43 +0000
commit760b37bcae12f4bbc68bb6cabf6ed68d265b0826 (patch)
tree48753f1a1757fee866a7f6fcfac34709012ee572 /lib/Sema/SemaLambda.cpp
parentb326ca8ffbea96f9cc8a457b0f57be880304a6f5 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150166 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLambda.cpp')
-rw-r--r--lib/Sema/SemaLambda.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp
index d59018dedc..6d8e6a1029 100644
--- a/lib/Sema/SemaLambda.cpp
+++ b/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)