clear_consteval_vfns (vec<tree> &consteval_vtables)
{
for (tree vtable : consteval_vtables)
- for (constructor_elt &elt : *CONSTRUCTOR_ELTS (DECL_INITIAL (vtable)))
+ for (constructor_elt &elt : CONSTRUCTOR_ELTS (DECL_INITIAL (vtable)))
{
tree fn = cp_get_fndecl_from_callee (elt.value, /*fold*/false);
if (fn && DECL_IMMEDIATE_FUNCTION_P (fn))
{
tree default_arg = TREE_PURPOSE (parm);
tree parsed_arg;
- vec<tree, va_gc> *insts;
- tree copy;
- unsigned ix;
tree parmdecl = parms[i];
pushdecl (parmdecl);
TREE_PURPOSE (parm) = parsed_arg;
/* Update any instantiations we've already created. */
- for (insts = DEFPARSE_INSTANTIATIONS (default_arg), ix = 0;
- vec_safe_iterate (insts, ix, ©); ix++)
+ for (tree copy : DEFPARSE_INSTANTIATIONS (default_arg))
TREE_PURPOSE (copy) = parsed_arg;
}
/* We don't recurse here because we can't deduce from a nested
initializer_list. */
if (CONSTRUCTOR_ELTS (init))
- for (constructor_elt &elt : *CONSTRUCTOR_ELTS (init))
+ for (constructor_elt &elt : CONSTRUCTOR_ELTS (init))
elt.value = resolve_nondeduced_context (elt.value, complain);
}
else
{
vec<constructor_elt, va_gc> *v = NULL;
- for (tree t : *vals)
+ for (tree t : vals)
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, t);
return build_constructor (type, v);
{
};
+/* Allow C++11 range-based 'for' to work directly on vec<T>*. */
+template<typename T, typename A, typename L>
+T* begin (vec<T,A,L> *v) { return v ? v->begin () : nullptr; }
+template<typename T, typename A, typename L>
+T* end (vec<T,A,L> *v) { return v ? v->end () : nullptr; }
+template<typename T, typename A, typename L>
+const T* begin (const vec<T,A,L> *v) { return v ? v->begin () : nullptr; }
+template<typename T, typename A, typename L>
+const T* end (const vec<T,A,L> *v) { return v ? v->end () : nullptr; }
+
/* Generic vec<> debug helpers.
These need to be instantiated for each vec<TYPE> used throughout