tree type;
type = TREE_TYPE (decl);
+ if (type == error_mark_node)
+ return error_mark_node;
if (IS_AGGR_TYPE (type)
&& CLASSTYPE_TEMPLATE_INFO (type)
&& !CLASSTYPE_TEMPLATE_SPECIALIZATION (type))
(struct find_parameter_pack_data*)data;
bool parameter_pack_p = false;
- /* Don't visit nodes twice. */
- if (pointer_set_contains (ppd->visited, *tp))
- {
- *walk_subtrees = 0;
- return NULL_TREE;
- }
-
/* Identify whether this is a parameter pack or not. */
switch (TREE_CODE (t))
{
*ppd->parameter_packs = tree_cons (NULL_TREE, t, *ppd->parameter_packs);
}
- /* Make sure we do not visit this node again. */
- pointer_set_insert (ppd->visited, *tp);
-
if (TYPE_P (t))
cp_walk_tree (&TYPE_CONTEXT (t),
- &find_parameter_packs_r, ppd, NULL);
+ &find_parameter_packs_r, ppd, ppd->visited);
/* This switch statement will return immediately if we don't find a
parameter pack. */
case BOUND_TEMPLATE_TEMPLATE_PARM:
/* Check the template itself. */
cp_walk_tree (&TREE_TYPE (TYPE_TI_TEMPLATE (t)),
- &find_parameter_packs_r, ppd, NULL);
+ &find_parameter_packs_r, ppd, ppd->visited);
/* Check the template arguments. */
cp_walk_tree (&TYPE_TI_ARGS (t), &find_parameter_packs_r, ppd,
- NULL);
+ ppd->visited);
*walk_subtrees = 0;
return NULL_TREE;
case ENUMERAL_TYPE:
if (TYPE_TEMPLATE_INFO (t))
cp_walk_tree (&TREE_VALUE (TYPE_TEMPLATE_INFO (t)),
- &find_parameter_packs_r, ppd, NULL);
+ &find_parameter_packs_r, ppd, ppd->visited);
*walk_subtrees = 0;
return NULL_TREE;
case TEMPLATE_DECL:
cp_walk_tree (&TREE_TYPE (t),
- &find_parameter_packs_r, ppd, NULL);
+ &find_parameter_packs_r, ppd, ppd->visited);
return NULL_TREE;
case TYPENAME_TYPE:
cp_walk_tree (&TYPENAME_TYPE_FULLNAME (t), &find_parameter_packs_r,
- ppd, NULL);
+ ppd, ppd->visited);
*walk_subtrees = 0;
return NULL_TREE;
case INTEGER_TYPE:
cp_walk_tree (&TYPE_MAX_VALUE (t), &find_parameter_packs_r,
- ppd, NULL);
+ ppd, ppd->visited);
*walk_subtrees = 0;
return NULL_TREE;
case IDENTIFIER_NODE:
- cp_walk_tree (&TREE_TYPE (t), &find_parameter_packs_r, ppd, NULL);
+ cp_walk_tree (&TREE_TYPE (t), &find_parameter_packs_r, ppd,
+ ppd->visited);
*walk_subtrees = 0;
return NULL_TREE;
struct find_parameter_pack_data ppd;
ppd.parameter_packs = ¶meter_packs;
ppd.visited = pointer_set_create ();
- cp_walk_tree (&t, &find_parameter_packs_r, &ppd, NULL);
+ cp_walk_tree (&t, &find_parameter_packs_r, &ppd, ppd.visited);
pointer_set_destroy (ppd.visited);
return parameter_packs != NULL_TREE;
}
ppd.visited = pointer_set_create ();
ppd.parameter_packs = ¶meter_packs;
cp_walk_tree (&TREE_PURPOSE (arg), &find_parameter_packs_r,
- &ppd, NULL);
+ &ppd, ppd.visited);
if (parameter_packs == NULL_TREE)
{
/* Determine which parameter packs will be expanded in this
argument. */
cp_walk_tree (&TREE_VALUE (value), &find_parameter_packs_r,
- &ppd, NULL);
+ &ppd, ppd.visited);
}
}
/* Determine which parameter packs will be expanded. */
ppd.parameter_packs = ¶meter_packs;
ppd.visited = pointer_set_create ();
- cp_walk_tree (&arg, &find_parameter_packs_r, &ppd, NULL);
+ cp_walk_tree (&arg, &find_parameter_packs_r, &ppd, ppd.visited);
pointer_set_destroy (ppd.visited);
/* Make sure we found some parameter packs. */
ppd.parameter_packs = ¶meter_packs;
ppd.visited = pointer_set_create ();
- cp_walk_tree (&t, &find_parameter_packs_r, &ppd, NULL);
+ cp_walk_tree (&t, &find_parameter_packs_r, &ppd, ppd.visited);
pointer_set_destroy (ppd.visited);
if (parameter_packs)
parameter_packs = TREE_CHAIN (parameter_packs);
}
- /* Clean up any references to these parameter packs within the
- tree. */
- ppd.parameter_packs = ¶meter_packs;
- ppd.visited = pointer_set_create ();
- cp_walk_tree (&t, &find_parameter_packs_r, &ppd, NULL);
- pointer_set_destroy (ppd.visited);
-
return true;
}
TYPE_RAISES_EXCEPTIONS (type) = NULL_TREE;
}
else if (check_for_bare_parameter_packs (TREE_TYPE (decl)))
- return error_mark_node;
+ {
+ TREE_TYPE (decl) = error_mark_node;
+ return error_mark_node;
+ }
if (is_partial)
return process_partial_specialization (decl);