r369725 - Revert "PR42587: diagnose unexpanded uses of a pack parameter of a generic" due to buildbot breakage.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 22 19:33:46 PDT 2019


Author: rsmith
Date: Thu Aug 22 19:33:46 2019
New Revision: 369725

URL: http://llvm.org/viewvc/llvm-project?rev=369725&view=rev
Log:
Revert "PR42587: diagnose unexpanded uses of a pack parameter of a generic" due to buildbot breakage.

This reverts commit r369722.

Modified:
    cfe/trunk/lib/Sema/SemaLambda.cpp
    cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
    cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp

Modified: cfe/trunk/lib/Sema/SemaLambda.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLambda.cpp?rev=369725&r1=369724&r2=369725&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLambda.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLambda.cpp Thu Aug 22 19:33:46 2019
@@ -928,12 +928,12 @@ void Sema::ActOnStartOfLambdaDefinition(
 
     // 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());

Modified: cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp?rev=369725&r1=369724&r2=369725&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp Thu Aug 22 19:33:46 2019
@@ -313,17 +313,10 @@ Sema::DiagnoseUnexpandedParameterPacks(S
 
     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() == LambdaDC)
+          if (VD && VD->getDeclContext() == LSI->CallOperator)
             LambdaParamPackReferences.push_back(Pack);
         }
       }

Modified: cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp?rev=369725&r1=369724&r2=369725&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas-variadics.cpp Thu Aug 22 19:33:46 2019
@@ -122,11 +122,3 @@ namespace PR33082 {
     b(Pack<int*, float*>(), 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}}
-}




More information about the cfe-commits mailing list