On Thu, Mar 3, 2016 at 8:41 PM, Jason Merrill <ja...@redhat.com> wrote: > When we instantiate an element of a pack expansion, we replace the argument > pack in the template argument vec with an ARGUMENT_PACK_SELECT which > indicates the desired element of the vec. If the args have been used to > instantiate other templates as well, the args of those instances get > modified as well, which can lead to strange results when we run into > ARGUMENT_PACK_SELECT in inappropriate places. This patch fixes this issue > by making a copy of the template args before we start messing with them.
...so we don't need to deal with ARGUMENT_PACK_SELECT in the hash tables anymore.
commit b5cb8944e6feb6f4c53170c5d58bc50e4fa5503a Author: Jason Merrill <ja...@redhat.com> Date: Tue Jul 19 12:49:53 2016 -0400 PR c++/67164 - clean up dead code * pt.c (iterative_hash_template_arg, template_args_equal): Don't handle ARGUMENT_PACK_SELECT. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 916fd7b..7c7024c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1704,9 +1704,7 @@ iterative_hash_template_arg (tree arg, hashval_t val) STRIP_NOPS (arg); if (TREE_CODE (arg) == ARGUMENT_PACK_SELECT) - /* We can get one of these when re-hashing a previous entry in the middle - of substituting into a pack expansion. Just look through it. */ - arg = ARGUMENT_PACK_SELECT_FROM_PACK (arg); + gcc_unreachable (); code = TREE_CODE (arg); tclass = TREE_CODE_CLASS (code); @@ -7894,17 +7892,7 @@ template_args_equal (tree ot, tree nt) return 1; } else if (ot && TREE_CODE (ot) == ARGUMENT_PACK_SELECT) - { - /* We get here probably because we are in the middle of substituting - into the pattern of a pack expansion. In that case the - ARGUMENT_PACK_SELECT temporarily replaces the pack argument we are - interested in. So we want to use the initial pack argument for - the comparison. */ - ot = ARGUMENT_PACK_SELECT_FROM_PACK (ot); - if (nt && TREE_CODE (nt) == ARGUMENT_PACK_SELECT) - nt = ARGUMENT_PACK_SELECT_FROM_PACK (nt); - return template_args_equal (ot, nt); - } + gcc_unreachable (); else if (TYPE_P (nt)) { if (!TYPE_P (ot))