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
diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp
index d59018d..6d8e6a1 100644
--- a/lib/Sema/SemaLambda.cpp
+++ b/lib/Sema/SemaLambda.cpp
@@ -351,7 +351,9 @@
     // 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)