aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaLambda.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-02-20 20:47:06 +0000
committerDouglas Gregor <dgregor@apple.com>2012-02-20 20:47:06 +0000
commitfa07ab57eb565b4a00712adcefb29d96b445bfcd (patch)
tree6370b8641a1e4c937fe5dd16ece9ff17e88e6ce8 /lib/Sema/SemaLambda.cpp
parentaf300298ab86752fa64e339ba34195888a830756 (diff)
Make sure that we set up the right declaration contexts when creating
and introducing the lambda closure type and its function call operator. Previously, we assumed that the lambda closure type would land directly in the current context, and not some parent context (as occurs with linkage specifications). Thanks to Richard for the test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150987 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLambda.cpp')
-rw-r--r--lib/Sema/SemaLambda.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp
index d1f87a2c18..6d54d403aa 100644
--- a/lib/Sema/SemaLambda.cpp
+++ b/lib/Sema/SemaLambda.cpp
@@ -28,7 +28,7 @@ CXXRecordDecl *Sema::createLambdaClosureType(SourceRange IntroducerRange) {
// Start constructing the lambda class.
CXXRecordDecl *Class = CXXRecordDecl::CreateLambda(Context, DC,
IntroducerRange.getBegin());
- CurContext->addDecl(Class);
+ DC->addDecl(Class);
return Class;
}
@@ -65,7 +65,7 @@ CXXMethodDecl *Sema::startLambdaDefinition(CXXRecordDecl *Class,
// Temporarily set the lexical declaration context to the current
// context, so that the Scope stack matches the lexical nesting.
- Method->setLexicalDeclContext(Class->getDeclContext());
+ Method->setLexicalDeclContext(CurContext);
// Add parameters.
if (!Params.empty()) {