diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-02-14 00:00:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-02-14 00:00:48 +0000 |
commit | d5387e86ce3dfe1ae09e050ee11d86ca0d066d04 (patch) | |
tree | dc324b8b16eac75b96b3b03e86a30595eb60ff0d /lib/Sema/SemaLambda.cpp | |
parent | e76872e81ea32fbc863d8d7ef6eadc91a8f8673b (diff) |
Link together the call operator produced from transforming a lambda
expression with the original call operator, so that we don't try to
separately instantiate the call operator. Test and tweak a few more
bits for template instantiation of lambda expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150440 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLambda.cpp')
-rw-r--r-- | lib/Sema/SemaLambda.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index f97b5232ac..0ce1c74163 100644 --- a/lib/Sema/SemaLambda.cpp +++ b/lib/Sema/SemaLambda.cpp @@ -521,19 +521,21 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body, // C++11 [expr.prim.lambda]p2: // A lambda-expression shall not appear in an unevaluated operand // (Clause 5). - switch (ExprEvalContexts.back().Context) { - case Unevaluated: - // We don't actually diagnose this case immediately, because we - // could be within a context where we might find out later that - // the expression is potentially evaluated (e.g., for typeid). - ExprEvalContexts.back().Lambdas.push_back(Lambda); - break; - - case ConstantEvaluated: - case PotentiallyEvaluated: - case PotentiallyEvaluatedIfUsed: - break; - } + if (!CurContext->isDependentContext()) { + switch (ExprEvalContexts.back().Context) { + case Unevaluated: + // We don't actually diagnose this case immediately, because we + // could be within a context where we might find out later that + // the expression is potentially evaluated (e.g., for typeid). + ExprEvalContexts.back().Lambdas.push_back(Lambda); + break; + case ConstantEvaluated: + case PotentiallyEvaluated: + case PotentiallyEvaluatedIfUsed: + break; + } + } + return MaybeBindToTemporary(Lambda); } |