diff mbox

C++ PATCH to argument_pack_element_is_expansion_p

Message ID 559AFD6E.7020503@redhat.com
State New
Headers show

Commit Message

Jason Merrill July 6, 2015, 10:13 p.m. UTC
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.
diff mbox

Patch

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))