holds the set of template parameters that were in-scope when this 'auto'
was formed. */
#define PLACEHOLDER_TYPE_CONSTRAINTS_INFO(NODE) \
- DECL_SIZE_UNIT (TYPE_NAME (NODE))
+ DECL_SIZE_UNIT (TYPE_NAME (TEMPLATE_TYPE_PARM_CHECK (NODE)))
/* The constraints on the 'auto' placeholder type NODE. */
#define PLACEHOLDER_TYPE_CONSTRAINTS(NODE) \
templates are primary, too. */
/* Returns the primary template corresponding to these parameters. */
-#define TPARMS_PRIMARY_TEMPLATE(NODE) (TREE_TYPE (NODE))
+#define TPARMS_PRIMARY_TEMPLATE(NODE) (TREE_TYPE (TREE_VEC_CHECK (NODE)))
#define DECL_PRIMARY_TEMPLATE(NODE) \
(TPARMS_PRIMARY_TEMPLATE (DECL_INNERMOST_TEMPLATE_PARMS (NODE)))
#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL(NODE) \
((TREE_CODE (NODE) == BOUND_TEMPLATE_TEMPLATE_PARM) \
? TYPE_TI_TEMPLATE (NODE) \
- : TYPE_NAME (NODE))
+ : TYPE_NAME (TEMPLATE_TEMPLATE_PARM_CHECK (NODE)))
/* in lex.cc */
case TEMPLATE_PARM_INDEX:
case BOUND_TEMPLATE_TEMPLATE_PARM:
pp_cxx_unqualified_id (this, t);
- if (tree c = PLACEHOLDER_TYPE_CONSTRAINTS (t))
- pp_cxx_constrained_type_spec (this, c);
+ if (TREE_CODE (t) == TEMPLATE_TYPE_PARM)
+ if (tree c = PLACEHOLDER_TYPE_CONSTRAINTS (t))
+ pp_cxx_constrained_type_spec (this, c);
break;
case TYPENAME_TYPE:
pp_cxx_cv_qualifier_seq (pp, t);
if (template_placeholder_p (t))
{
- t = TREE_TYPE (CLASS_PLACEHOLDER_TEMPLATE (t));
- pp_cxx_tree_identifier (pp, TYPE_IDENTIFIER (t));
+ tree tmpl = TREE_TYPE (CLASS_PLACEHOLDER_TEMPLATE (t));
+ pp_cxx_tree_identifier (pp, TYPE_IDENTIFIER (tmpl));
pp_string (pp, "<...auto...>");
}
else if (TYPE_IDENTIFIER (t))
return args;
if (TMPL_ARGS_DEPTH (args) == 1)
return NULL_TREE;
- args = copy_node (args);
- --TREE_VEC_LENGTH (args);
- return args;
+ return strip_innermost_template_args (args, 1);
}
/* Update the declared TYPE by doing any lookups which were thought to be
bool
any_type_dependent_arguments_p (const vec<tree, va_gc> *args)
{
- unsigned int i;
- tree arg;
+ if (!processing_template_decl || !args)
+ return false;
+
+ for (tree arg : *args)
+ if (type_dependent_expression_p (arg))
+ return true;
- FOR_EACH_VEC_SAFE_ELT (args, i, arg)
- {
- if (type_dependent_expression_p (arg))
- return true;
- }
return false;
}
bool
any_dependent_template_arguments_p (const_tree args)
{
- int i;
- int j;
-
- if (!args)
- return false;
if (args == error_mark_node)
return true;
+ if (!processing_template_decl || !args)
+ return false;
- for (i = 0; i < TMPL_ARGS_DEPTH (args); ++i)
+ for (int i = 0, depth = TMPL_ARGS_DEPTH (args); i < depth; ++i)
{
const_tree level = TMPL_ARGS_LEVEL (args, i + 1);
- for (j = 0; j < TREE_VEC_LENGTH (level); ++j)
- if (dependent_template_arg_p (TREE_VEC_ELT (level, j)))
+ for (tree arg : tree_vec_range (CONST_CAST_TREE (level)))
+ if (dependent_template_arg_p (arg))
return true;
}