From: Richard Smith Date: Fri, 23 Aug 2019 02:33:46 +0000 (+0000) Subject: Revert "PR42587: diagnose unexpanded uses of a pack parameter of a generic" due to... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26676a6b54999961eb5c0329b017d366cb5e19fc;p=clang Revert "PR42587: diagnose unexpanded uses of a pack parameter of a generic" due to buildbot breakage. This reverts commit r369722. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@369725 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index 6938804e5f..e7c51a3e3d 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()) - DiagnoseUnexpandedParameterPack(Intro.Range.getBegin(), MethodTyInfo, - UPPC_DeclarationType); + ContainsUnexpandedParameterPack = true; } 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 b766e3c568..f90bff6e7a 100644 --- a/lib/Sema/SemaTemplateVariadic.cpp +++ b/lib/Sema/SemaTemplateVariadic.cpp @@ -313,17 +313,10 @@ Sema::DiagnoseUnexpandedParameterPacks(SourceLocation Loc, if (auto *LSI = dyn_cast(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( Pack.first.dyn_cast()); - if (VD && VD->getDeclContext() == LambdaDC) + if (VD && VD->getDeclContext() == LSI->CallOperator) LambdaParamPackReferences.push_back(Pack); } } diff --git a/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp b/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp index 22afdc08d9..b8022d2091 100644 --- a/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp +++ b/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp @@ -122,11 +122,3 @@ namespace PR33082 { b(Pack(), 1, 2, 3); // expected-note {{instantiation of}} } } - -void pr42587() { - (void)[](auto... args) -> decltype(args) {}; // expected-error {{type contains unexpanded parameter pack}} - (void)[](auto... args, int = args) {}; // expected-error {{default argument contains unexpanded parameter pack}} - (void)[](auto... args, decltype(args)) {}; // expected-error {{type contains unexpanded parameter pack}} - (void)[](auto... args, decltype(args)...) {}; // (ok) - (void)[](auto... args, int = [=] { return args; }()) {}; // expected-error {{default argument contains unexpanded parameter pack}} -}