{
tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i));
- if (parm == error_mark_node)
+ if (error_operand_p (parm))
continue;
gcc_assert (DECL_P (parm));
/* If either of the template parameters are invalid, assume
they match for the sake of error recovery. */
- if (parm1 == error_mark_node || parm2 == error_mark_node)
+ if (error_operand_p (parm1) || error_operand_p (parm2))
return 1;
if (TREE_CODE (parm1) != TREE_CODE (parm2))
to the LIST being built. This new parameter is a non-type
parameter iff IS_NON_TYPE is true. This new parameter is a
parameter pack iff IS_PARAMETER_PACK is true. The location of PARM
- is in PARM_LOC. NUM_TEMPLATE_PARMS is the size of the template
- parameter list PARM belongs to. This is used used to create a
- proper canonical type for the type of PARM that is to be created,
- iff PARM is a type. If the size is not known, this parameter shall
- be set to 0. */
+ is in PARM_LOC. */
tree
process_template_parm (tree list, location_t parm_loc, tree parm,
{
tree decl = 0;
tree defval;
- tree err_parm_list;
int idx = 0;
gcc_assert (TREE_CODE (parm) == TREE_LIST);
++idx;
}
- else
- idx = 0;
if (is_non_type)
{
SET_DECL_TEMPLATE_PARM_P (parm);
- if (TREE_TYPE (parm) == error_mark_node)
- {
- err_parm_list = build_tree_list (defval, parm);
- TREE_VALUE (err_parm_list) = error_mark_node;
- return chainon (list, err_parm_list);
- }
- else
- {
- /* [temp.param]
-
- The top-level cv-qualifiers on the template-parameter are
- ignored when determining its type. */
- TREE_TYPE (parm) = TYPE_MAIN_VARIANT (TREE_TYPE (parm));
- if (invalid_nontype_parm_type_p (TREE_TYPE (parm), 1))
- {
- err_parm_list = build_tree_list (defval, parm);
- TREE_VALUE (err_parm_list) = error_mark_node;
- return chainon (list, err_parm_list);
- }
+ if (TREE_TYPE (parm) != error_mark_node)
+ {
+ /* [temp.param]
+
+ The top-level cv-qualifiers on the template-parameter are
+ ignored when determining its type. */
+ TREE_TYPE (parm) = TYPE_MAIN_VARIANT (TREE_TYPE (parm));
+ if (invalid_nontype_parm_type_p (TREE_TYPE (parm), 1))
+ TREE_TYPE (parm) = error_mark_node;
+ else if (uses_parameter_packs (TREE_TYPE (parm))
+ && !is_parameter_pack
+ /* If we're in a nested template parameter list, the template
+ template parameter could be a parameter pack. */
+ && processing_template_parmlist == 1)
+ {
+ /* This template parameter is not a parameter pack, but it
+ should be. Complain about "bare" parameter packs. */
+ check_for_bare_parameter_packs (TREE_TYPE (parm));
- if (uses_parameter_packs (TREE_TYPE (parm)) && !is_parameter_pack
- /* If we're in a nested template parameter list, the template
- template parameter could be a parameter pack. */
- && processing_template_parmlist == 1)
- {
- /* This template parameter is not a parameter pack, but it
- should be. Complain about "bare" parameter packs. */
- check_for_bare_parameter_packs (TREE_TYPE (parm));
-
- /* Recover by calling this a parameter pack. */
- is_parameter_pack = true;
- }
- }
+ /* Recover by calling this a parameter pack. */
+ is_parameter_pack = true;
+ }
+ }
/* A template parameter is not modifiable. */
TREE_CONSTANT (parm) = 1;
continue;
tmpl_parm = TREE_VALUE (TREE_VEC_ELT (tmpl_parms, i));
- if (tmpl_parm == error_mark_node)
+ if (error_operand_p (tmpl_parm))
return false;
parm = TREE_VALUE (TREE_VEC_ELT (parms, i));
tree in_decl,
tree outer_args)
{
- if (arg == NULL_TREE || arg == error_mark_node
- || parm == NULL_TREE || parm == error_mark_node)
+ if (arg == NULL_TREE || error_operand_p (arg)
+ || parm == NULL_TREE || error_operand_p (parm))
return 0;
if (TREE_CODE (arg) != TREE_CODE (parm))
{
parm = TREE_VALUE (TREE_VEC_ELT (parm_parms, nparms - 1));
- if (parm == error_mark_node)
+ if (error_operand_p (parm))
return 0;
switch (TREE_CODE (parm))
case TEMPLATE_TEMPLATE_PARM:
case BOUND_TEMPLATE_TEMPLATE_PARM:
tparm = TREE_VALUE (TREE_VEC_ELT (tparms, 0));
- if (tparm == error_mark_node)
+ if (error_operand_p (tparm))
return unify_invalid (explain_p);
if (TEMPLATE_TYPE_LEVEL (parm)
idx = TEMPLATE_TYPE_IDX (parm);
targ = TREE_VEC_ELT (INNERMOST_TEMPLATE_ARGS (targs), idx);
tparm = TREE_VALUE (TREE_VEC_ELT (tparms, idx));
- if (tparm == error_mark_node)
+ if (error_operand_p (tparm))
return unify_invalid (explain_p);
/* Check for mixed types and values. */
case TEMPLATE_PARM_INDEX:
tparm = TREE_VALUE (TREE_VEC_ELT (tparms, 0));
- if (tparm == error_mark_node)
+ if (error_operand_p (tparm))
return unify_invalid (explain_p);
if (TEMPLATE_PARM_LEVEL (parm)