[C++ PATCH] P0962 change cleanup (PR c++/85312)

Jason Merrill jason@redhat.com
Tue Apr 10 14:23:00 GMT 2018


OK.

On Tue, Apr 10, 2018 at 10:10 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> The "Implement P0962" change changed the
> if (member_begin != NULL_TREE || member_end != NULL_TREE)
> condition to
> if (member_begin != NULL_TREE && member_end != NULL_TREE)
> but that created a lot of dead-code, because now the diagnostics in that
> if is unreachable, we are always guaranteed both member_begin and member_end
> are non-NULL in that block.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2018-04-10  Jakub Jelinek  <jakub@redhat.com>
>
>         PR c++/85312 - P0962 cleanup
>         * parser.c (cp_parser_perform_range_for_lookup): Remove unreachable
>         diagnostics.
>
> --- gcc/cp/parser.c.jj  2018-04-10 08:52:24.697790705 +0200
> +++ gcc/cp/parser.c     2018-04-10 12:40:11.359290679 +0200
> @@ -12041,17 +12041,8 @@ cp_parser_perform_range_for_lookup (tree
>        if (member_begin != NULL_TREE && member_end != NULL_TREE)
>         {
>           /* Use the member functions.  */
> -         if (member_begin != NULL_TREE)
> -           *begin = cp_parser_range_for_member_function (range, id_begin);
> -         else
> -           error ("range-based %<for%> expression of type %qT has an "
> -                  "%<end%> member but not a %<begin%>", TREE_TYPE (range));
> -
> -         if (member_end != NULL_TREE)
> -           *end = cp_parser_range_for_member_function (range, id_end);
> -         else
> -           error ("range-based %<for%> expression of type %qT has a "
> -                  "%<begin%> member but not an %<end%>", TREE_TYPE (range));
> +         *begin = cp_parser_range_for_member_function (range, id_begin);
> +         *end = cp_parser_range_for_member_function (range, id_end);
>         }
>        else
>         {
>
>         Jakub



More information about the Gcc-patches mailing list