aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-07-25 15:10:41 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-07-25 15:10:41 -0400
commitfd8b207a76d9a1eb8cc8e3c2f81b13391bd41310 (patch)
tree02f5b70985e265b3c49cd4c987323c5ec9ea6556 /gcc/cp
parent5ec2cd9f666a8d26ce62ee7ef6383948fafb1b35 (diff)
downloadgcc-fd8b207a76d9a1eb8cc8e3c2f81b13391bd41310.zip
gcc-fd8b207a76d9a1eb8cc8e3c2f81b13391bd41310.tar.gz
gcc-fd8b207a76d9a1eb8cc8e3c2f81b13391bd41310.tar.bz2
PR c++/71833 - member template with two parameter packs
PR c++/54440 * pt.c (coerce_template_parameter_pack): Fix logic for pack index. From-SVN: r238731
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c7
2 files changed, 9 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5854205..9ae7e67 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2016-07-25 Jason Merrill <jason@redhat.com>
+ PR c++/71833
+ PR c++/54440
+ * pt.c (coerce_template_parameter_pack): Fix logic for
+ pack index.
+
PR c++/65970
* constexpr.c (cxx_eval_loop_expr): Count iterations.
* cp-gimplify.c (genericize_cp_loop): Use start_locus even for
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a61f1c8..7dd6b25 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -7403,11 +7403,12 @@ coerce_template_parameter_pack (tree parms,
/* Convert the remaining arguments, which will be a part of the
parameter pack "parm". */
+ int first_pack_arg = arg_idx;
for (; arg_idx < nargs; ++arg_idx)
{
tree arg = TREE_VEC_ELT (inner_args, arg_idx);
tree actual_parm = TREE_VALUE (parm);
- int pack_idx = arg_idx - parm_idx;
+ int pack_idx = arg_idx - first_pack_arg;
if (packed_parms)
{
@@ -7436,12 +7437,12 @@ coerce_template_parameter_pack (tree parms,
TREE_VEC_ELT (packed_args, pack_idx) = arg;
}
- if (arg_idx - parm_idx < TREE_VEC_LENGTH (packed_args)
+ if (arg_idx - first_pack_arg < TREE_VEC_LENGTH (packed_args)
&& TREE_VEC_LENGTH (packed_args) > 0)
{
if (complain & tf_error)
error ("wrong number of template arguments (%d, should be %d)",
- arg_idx - parm_idx, TREE_VEC_LENGTH (packed_args));
+ arg_idx - first_pack_arg, TREE_VEC_LENGTH (packed_args));
return error_mark_node;
}