On Thu, Dec 03, 2020 at 12:53:22PM -0500, Jason Merrill via Gcc-patches wrote:
> It looks cleaner if we can use a vec* directly as a range for the C++11
> range-based 'for' loop, without needing to indirect from it, and also works
> with null pointers.

Nice.

> The change in cp_parser_late_parsing_default_args is an example of how this
> can be used to simplify many loops over vec*.
> 
> I deliberately didn't format the new overloads for etags since they are
> trivial, but am open to changing that.
> 
> Tested x86_64-pc-linux-gnu.  Is this OK for trunk now, or should I hold it for
> stage 1?

I'd vote for pushing this now as it's simple enough.

> --- a/gcc/cp/pt.c
> +++ b/gcc/cp/pt.c
> @@ -29273,7 +29273,7 @@ do_auto_deduction (tree type, tree init, tree 
> auto_node,
>        /* We don't recurse here because we can't deduce from a nested
>        initializer_list.  */
>        if (CONSTRUCTOR_ELTS (init))

Can this check go now or do we still need it?

> -     for (constructor_elt &elt : *CONSTRUCTOR_ELTS (init))
> +     for (constructor_elt &elt : CONSTRUCTOR_ELTS (init))
>         elt.value = resolve_nondeduced_context (elt.value, complain);

Marek

Reply via email to