re PR c++/41933 ([c++0x] lambdas and variadic templates don't work together)
authorJason Merrill <jason@redhat.com>
Sun, 15 Sep 2013 19:34:34 +0000 (15:34 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sun, 15 Sep 2013 19:34:34 +0000 (15:34 -0400)
PR c++/41933
* cp-tree.h (DECL_PACK_P): Replace FUNCTION_PARAMETER_PACK_P.
* cxx-pretty-print.c (direct_declarator): Adjust.
* decl2.c (cp_build_parm_decl): Adjust.
* pt.c (function_parameter_pack_p): Adjust.
(find_parameter_packs_r, push_template_decl_real): Adjust.
(tsubst_pack_expansion, tsubst_decl): Adjust.
(regenerate_decl_from_template, instantiate_decl): Adjust.

From-SVN: r202604

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/cxx-pretty-print.c
gcc/cp/decl2.c
gcc/cp/pt.c

index af243a2a4cfa8fd8655d8096b36b887113421ec6..9234ade438a9b9f8ee33592e21ed3b2540fd1290 100644 (file)
@@ -1,5 +1,14 @@
 2013-09-15  Jason Merrill  <jason@redhat.com>
 
+       PR c++/41933
+       * cp-tree.h (DECL_PACK_P): Replace FUNCTION_PARAMETER_PACK_P.
+       * cxx-pretty-print.c (direct_declarator): Adjust.
+       * decl2.c (cp_build_parm_decl): Adjust.
+       * pt.c (function_parameter_pack_p): Adjust.
+       (find_parameter_packs_r, push_template_decl_real): Adjust.
+       (tsubst_pack_expansion, tsubst_decl): Adjust.
+       (regenerate_decl_from_template, instantiate_decl): Adjust.
+
        * lambda.c (add_capture): Don't add DECL_LANG_SPECIFIC.
 
 2013-09-13  Jason Merrill  <jason@redhat.com>
index 0d8bd9544ca1bd4cd0cf734b2117f7827c7fd588..4680053f8733b18c81aa7dd634aa0ea4e2766ac9 100644 (file)
@@ -138,7 +138,6 @@ c-common.h, not after.
    1: C_TYPEDEF_EXPLICITLY_SIGNED (in TYPE_DECL).
       DECL_TEMPLATE_INSTANTIATED (in a VAR_DECL or a FUNCTION_DECL)
       DECL_MEMBER_TEMPLATE_P (in TEMPLATE_DECL)
-      FUNCTION_PARAMETER_PACK_P (in PARM_DECL)
       USING_DECL_TYPENAME_P (in USING_DECL)
       DECL_VLA_CAPTURE_P (in FIELD_DECL)
    2: DECL_THIS_EXTERN (in VAR_DECL or FUNCTION_DECL).
@@ -2874,10 +2873,9 @@ extern void decl_shadowed_for_var_insert (tree, tree);
    the class definition is complete.  */
 #define TEMPLATE_PARMS_FOR_INLINE(NODE) TREE_LANG_FLAG_1 (NODE)
 
-/* Determine if a parameter (i.e., a PARM_DECL) is a function
-   parameter pack.  */
-#define FUNCTION_PARAMETER_PACK_P(NODE) \
-  (DECL_LANG_FLAG_1 (PARM_DECL_CHECK (NODE)))
+/* Determine if a declaration (PARM_DECL or FIELD_DECL) is a pack.  */
+#define DECL_PACK_P(NODE) \
+  (DECL_P (NODE) && PACK_EXPANSION_P (TREE_TYPE (NODE)))
 
 /* Determines if NODE is an expansion of one or more parameter packs,
    e.g., a TYPE_PACK_EXPANSION or EXPR_PACK_EXPANSION.  */
index 86d8b471e7f68be615efdd41f60f09bce31c61a8..bcef8760ad7619df42638f07d5c43a952ad82b4f 100644 (file)
@@ -1527,7 +1527,7 @@ cxx_pretty_printer::direct_declarator (tree t)
        {
          pp_cxx_space_for_pointer_operator (this, TREE_TYPE (t));
 
-         if ((TREE_CODE (t) == PARM_DECL && FUNCTION_PARAMETER_PACK_P (t))
+         if ((TREE_CODE (t) == PARM_DECL && DECL_PACK_P (t))
              || template_parameter_pack_p (t))
            /* A function parameter pack or non-type template
               parameter pack.  */
index d5d29127cfd269ddd349db113834c9a408141516..c51855185d438088eab8cd572a4d7d18bc574ec3 100644 (file)
@@ -188,11 +188,6 @@ cp_build_parm_decl (tree name, tree type)
   if (!processing_template_decl)
     DECL_ARG_TYPE (parm) = type_passed_as (type);
 
-  /* If the type is a pack expansion, then we have a function
-     parameter pack. */
-  if (type && TREE_CODE (type) == TYPE_PACK_EXPANSION)
-    FUNCTION_PARAMETER_PACK_P (parm) = 1;
-
   return parm;
 }
 
index fed004c901313d5208d78d6b1cc0aceaeaafaa53..ecae904312f6694c3ae2775049c75453c370e0da 100644 (file)
@@ -2852,7 +2852,7 @@ bool
 function_parameter_pack_p (const_tree t)
 {
   if (t && TREE_CODE (t) == PARM_DECL)
-    return FUNCTION_PARAMETER_PACK_P (t);
+    return DECL_PACK_P (t);
   return false;
 }
 
@@ -3085,7 +3085,7 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
       break;
 
     case PARM_DECL:
-      if (FUNCTION_PARAMETER_PACK_P (t))
+      if (DECL_PACK_P (t))
         {
           /* We don't want to walk into the type of a PARM_DECL,
              because we don't want to see the type parameter pack.  */
@@ -4646,7 +4646,7 @@ push_template_decl_real (tree decl, bool is_friend)
 
       while (arg && argtype)
         {
-          if (!FUNCTION_PARAMETER_PACK_P (arg)
+          if (!DECL_PACK_P (arg)
               && check_for_bare_parameter_packs (TREE_TYPE (arg)))
             {
             /* This is a PARM_DECL that contains unexpanded parameter
@@ -9472,7 +9472,7 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
                 have the wrong value for a recursive call.  Just make a
                 dummy decl, since it's only used for its type.  */
              arg_pack = tsubst_decl (parm_pack, args, complain);
-             if (arg_pack && FUNCTION_PARAMETER_PACK_P (arg_pack))
+             if (arg_pack && DECL_PACK_P (arg_pack))
                /* Partial instantiation of the parm_pack, we can't build
                   up an argument pack yet.  */
                arg_pack = NULL_TREE;
@@ -10465,7 +10465,7 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
         tree prev_r = NULL_TREE;
         tree first_r = NULL_TREE;
 
-        if (FUNCTION_PARAMETER_PACK_P (t))
+        if (DECL_PACK_P (t))
           {
             /* If there is a local specialization that isn't a
                parameter pack, it means that we're doing a "simple"
@@ -10515,10 +10515,6 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
               /* We're on the Ith parameter of the function parameter
                  pack.  */
               {
-               /* An argument of a function parameter pack is not a parameter
-                  pack.  */
-               FUNCTION_PARAMETER_PACK_P (r) = false;
-
                 /* Get the Ith type.  */
                 type = TREE_VEC_ELT (expanded_types, i);
 
@@ -18705,7 +18701,7 @@ regenerate_decl_from_template (tree decl, tree tmpl)
       pattern_parm
        = skip_artificial_parms_for (code_pattern,
                                     DECL_ARGUMENTS (code_pattern));
-      while (decl_parm && !FUNCTION_PARAMETER_PACK_P (pattern_parm))
+      while (decl_parm && !DECL_PACK_P (pattern_parm))
        {
          tree parm_type;
          tree attributes;
@@ -18728,7 +18724,7 @@ regenerate_decl_from_template (tree decl, tree tmpl)
        }
       /* Merge any parameters that match with the function parameter
          pack.  */
-      if (pattern_parm && FUNCTION_PARAMETER_PACK_P (pattern_parm))
+      if (pattern_parm && DECL_PACK_P (pattern_parm))
         {
           int i, len;
           tree expanded_types;
@@ -19247,7 +19243,7 @@ instantiate_decl (tree d, int defer_ok,
        }
       for (; tmpl_parm; tmpl_parm = DECL_CHAIN (tmpl_parm))
        {
-         if (!FUNCTION_PARAMETER_PACK_P (tmpl_parm))
+         if (!DECL_PACK_P (tmpl_parm))
            {
              register_local_specialization (spec_parm, tmpl_parm);
              spec_parm = DECL_CHAIN (spec_parm);