Commit 98568e03 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/80309 (ICE: canonical types differ for identical types _Args2 and _Args2)

	PR c++/80309
	* pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead
	of a loop doing vec_safe_push of NULL.  Formatting fixes.
	(rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx
	to newidx before calling canonical_type_parameter on newtype.

From-SVN: r246717
parent 37d6671d
2017-04-05 Jakub Jelinek <jakub@redhat.com>
PR c++/80309
* pt.c (canonical_type_parameter): Use vec_safe_grow_cleared instead
of a loop doing vec_safe_push of NULL. Formatting fixes.
(rewrite_template_parm): Copy TEMPLATE_PARM_PARAMETER_PACK from oldidx
to newidx before calling canonical_type_parameter on newtype.
2017-04-04 Volker Reichelt <v.reichelt@netcologne.de> 2017-04-04 Volker Reichelt <v.reichelt@netcologne.de>
PR c++/80296 PR c++/80296
......
...@@ -3997,10 +3997,10 @@ canonical_type_parameter (tree type) ...@@ -3997,10 +3997,10 @@ canonical_type_parameter (tree type)
tree list; tree list;
int idx = TEMPLATE_TYPE_IDX (type); int idx = TEMPLATE_TYPE_IDX (type);
if (!canonical_template_parms) if (!canonical_template_parms)
vec_alloc (canonical_template_parms, idx+1); vec_alloc (canonical_template_parms, idx + 1);
while (canonical_template_parms->length () <= (unsigned)idx) if (canonical_template_parms->length () <= (unsigned) idx)
vec_safe_push (canonical_template_parms, NULL_TREE); vec_safe_grow_cleared (canonical_template_parms, idx + 1);
list = (*canonical_template_parms)[idx]; list = (*canonical_template_parms)[idx];
while (list && !comptypes (type, TREE_VALUE (list), COMPARE_STRUCTURAL)) while (list && !comptypes (type, TREE_VALUE (list), COMPARE_STRUCTURAL))
...@@ -4011,8 +4011,7 @@ canonical_type_parameter (tree type) ...@@ -4011,8 +4011,7 @@ canonical_type_parameter (tree type)
else else
{ {
(*canonical_template_parms)[idx] (*canonical_template_parms)[idx]
= tree_cons (NULL_TREE, type, = tree_cons (NULL_TREE, type, (*canonical_template_parms)[idx]);
(*canonical_template_parms)[idx]);
return type; return type;
} }
} }
...@@ -24955,6 +24954,8 @@ rewrite_template_parm (tree olddecl, unsigned index, unsigned level, ...@@ -24955,6 +24954,8 @@ rewrite_template_parm (tree olddecl, unsigned index, unsigned level,
newidx = TEMPLATE_TYPE_PARM_INDEX (newtype) newidx = TEMPLATE_TYPE_PARM_INDEX (newtype)
= build_template_parm_index (index, level, level, = build_template_parm_index (index, level, level,
newdecl, newtype); newdecl, newtype);
TEMPLATE_PARM_PARAMETER_PACK (newidx)
= TEMPLATE_PARM_PARAMETER_PACK (oldidx);
TYPE_STUB_DECL (newtype) = TYPE_NAME (newtype) = newdecl; TYPE_STUB_DECL (newtype) = TYPE_NAME (newtype) = newdecl;
TYPE_CANONICAL (newtype) = canonical_type_parameter (newtype); TYPE_CANONICAL (newtype) = canonical_type_parameter (newtype);
...@@ -25002,11 +25003,11 @@ rewrite_template_parm (tree olddecl, unsigned index, unsigned level, ...@@ -25002,11 +25003,11 @@ rewrite_template_parm (tree olddecl, unsigned index, unsigned level,
SET_DECL_TEMPLATE_PARM_P (newconst); SET_DECL_TEMPLATE_PARM_P (newconst);
newidx = build_template_parm_index (index, level, level, newidx = build_template_parm_index (index, level, level,
newconst, newtype); newconst, newtype);
TEMPLATE_PARM_PARAMETER_PACK (newidx)
= TEMPLATE_PARM_PARAMETER_PACK (oldidx);
DECL_INITIAL (newdecl) = DECL_INITIAL (newconst) = newidx; DECL_INITIAL (newdecl) = DECL_INITIAL (newconst) = newidx;
} }
TEMPLATE_PARM_PARAMETER_PACK (newidx)
= TEMPLATE_PARM_PARAMETER_PACK (oldidx);
return newdecl; return newdecl;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment