This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH to argument_pack_element_is_expansion_p


In tsubst_pack_expansion, when we don't have fully instantiated arguments we try to do a partial instantiation of the pattern if all the arguments we have are of similar form, for instance if all of them are pack expansions. In one case with concepts we were failing to do that and falling back on the PACK_EXPANSION_EXTRA_ARGS mechanism unnecessarily because we didn't recognize a function parameter pack as itself a pack expansion, which it properly is because its type is a pack expansion. This should be an efficiency improvement on the trunk, as well.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit 659af9891dc5046e584e7e0901fd857dc70dddda
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Jul 3 13:49:03 2015 -0400

    	* pt.c (argument_pack_element_is_expansion_p): A decl pack is an
    	expansion.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e819b69..0302de1 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -9838,6 +9838,9 @@ argument_pack_element_is_expansion_p (tree arg_pack, int i)
   if (i >= TREE_VEC_LENGTH (vec))
     return 0;
   tree elt = TREE_VEC_ELT (vec, i);
+  if (DECL_P (elt))
+    /* A decl pack is itself an expansion.  */
+    elt = TREE_TYPE (elt);
   if (!PACK_EXPANSION_P (elt))
     return 0;
   if (PACK_EXPANSION_EXTRA_ARGS (elt))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]