diff options
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaLambda.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateVariadic.cpp | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index e7c51a3e3d..6938804e5f 100644 --- a/lib/Sema/SemaLambda.cpp +++ b/lib/Sema/SemaLambda.cpp @@ -928,12 +928,12 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, // Check for unexpanded parameter packs in the method type. if (MethodTyInfo->getType()->containsUnexpandedParameterPack()) - ContainsUnexpandedParameterPack = true; + DiagnoseUnexpandedParameterPack(Intro.Range.getBegin(), MethodTyInfo, + UPPC_DeclarationType); } CXXRecordDecl *Class = createLambdaClosureType(Intro.Range, MethodTyInfo, KnownDependent, Intro.Default); - CXXMethodDecl *Method = startLambdaDefinition(Class, Intro.Range, MethodTyInfo, EndLoc, Params, ParamInfo.getDeclSpec().getConstexprSpecifier()); diff --git a/lib/Sema/SemaTemplateVariadic.cpp b/lib/Sema/SemaTemplateVariadic.cpp index f90bff6e7a..b766e3c568 100644 --- a/lib/Sema/SemaTemplateVariadic.cpp +++ b/lib/Sema/SemaTemplateVariadic.cpp @@ -313,10 +313,17 @@ Sema::DiagnoseUnexpandedParameterPacks(SourceLocation Loc, if (auto *LSI = dyn_cast<sema::LambdaScopeInfo>(Func)) { if (N == FunctionScopes.size()) { + const DeclContext *LambdaDC = LSI->CallOperator; + // While we're parsing the lambda-declarator, we don't have a call + // operator yet and the parameters instead get temporarily attached + // to the translation unit. + if (!LambdaDC) + LambdaDC = Context.getTranslationUnitDecl(); + for (auto &Pack : Unexpanded) { auto *VD = dyn_cast_or_null<VarDecl>( Pack.first.dyn_cast<NamedDecl *>()); - if (VD && VD->getDeclContext() == LSI->CallOperator) + if (VD && VD->getDeclContext() == LambdaDC) LambdaParamPackReferences.push_back(Pack); } } |