+2020-02-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/92654
+ * tree.c (cp_walk_subtrees): Walk into type template arguments.
+ * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
+ instead of TYPE_ALIAS_P.
+ * pt.c (push_template_decl_real): Likewise.
+ (find_parameter_packs_r): Likewise. Remove dead code.
+ * error.c (find_typenames_r): Remove dead code.
+
2020-02-06 Jason Merrill <jason@redhat.com>
PR c++/92517
if (mv && (mv == *tp || !d->p_set->add (mv)))
vec_safe_push (d->typenames, mv);
- /* Search into class template arguments, which cp_walk_subtrees
- doesn't do. */
- if (CLASS_TYPE_P (*tp) && CLASSTYPE_TEMPLATE_INFO (*tp))
- cp_walk_tree (&CLASSTYPE_TI_ARGS (*tp), find_typenames_r,
- data, d->p_set);
-
return NULL_TREE;
}
(struct find_parameter_pack_data*)data;
bool parameter_pack_p = false;
- /* Handle type aliases/typedefs. */
- if (TYPE_ALIAS_P (t))
+ /* Don't look through typedefs; we are interested in whether a
+ parameter pack is actually written in the expression/type we're
+ looking at, not the target type. */
+ if (TYPE_P (t) && typedef_variant_p (t))
{
+ /* But do look at arguments for an alias template. */
if (tree tinfo = TYPE_ALIAS_TEMPLATE_INFO (t))
cp_walk_tree (&TI_ARGS (tinfo),
&find_parameter_packs_r,
&find_parameter_packs_r, ppd, ppd->visited);
/* This switch statement will return immediately if we don't find a
- parameter pack. */
+ parameter pack. ??? Should some of these be in cp_walk_subtrees? */
switch (TREE_CODE (t))
{
- case TEMPLATE_PARM_INDEX:
- return NULL_TREE;
-
case BOUND_TEMPLATE_TEMPLATE_PARM:
/* Check the template itself. */
cp_walk_tree (&TREE_TYPE (TYPE_TI_TEMPLATE (t)),
&find_parameter_packs_r, ppd, ppd->visited);
- /* Check the template arguments. */
- cp_walk_tree (&TYPE_TI_ARGS (t), &find_parameter_packs_r, ppd,
- ppd->visited);
- *walk_subtrees = 0;
- return NULL_TREE;
-
- case TEMPLATE_TYPE_PARM:
- case TEMPLATE_TEMPLATE_PARM:
- return NULL_TREE;
-
- case PARM_DECL:
return NULL_TREE;
case DECL_EXPR:
*walk_subtrees = 0;
return NULL_TREE;
- case RECORD_TYPE:
- if (TYPE_PTRMEMFUNC_P (t))
- return NULL_TREE;
- /* Fall through. */
-
- case UNION_TYPE:
- case ENUMERAL_TYPE:
- if (TYPE_TEMPLATE_INFO (t))
- cp_walk_tree (&TYPE_TI_ARGS (t),
- &find_parameter_packs_r, ppd, ppd->visited);
-
- *walk_subtrees = 0;
- return NULL_TREE;
-
case TEMPLATE_DECL:
if (!DECL_TEMPLATE_TEMPLATE_PARM_P (t))
return NULL_TREE;
if (check_for_bare_parameter_packs (TYPE_RAISES_EXCEPTIONS (type)))
TYPE_RAISES_EXCEPTIONS (type) = NULL_TREE;
}
- else if (check_for_bare_parameter_packs ((TREE_CODE (decl) == TYPE_DECL
- && TYPE_DECL_ALIAS_P (decl))
+ else if (check_for_bare_parameter_packs (is_typedef_decl (decl)
? DECL_ORIGINAL_TYPE (decl)
: TREE_TYPE (decl)))
{