This is the mail archive of the
mailing list for the GCC project.
Re: C++ PATCH for c++/91391 - bogus -Wcomma-subscript warning
- From: Jason Merrill <jason at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>
- Date: Wed, 14 Aug 2019 10:40:07 -0400
- Subject: Re: C++ PATCH for c++/91391 - bogus -Wcomma-subscript warning
- References: <20190807200553.GS28284@redhat.com> <20190814131530.GL14737@redhat.com>
On 8/14/19 9:15 AM, Marek Polacek wrote:
On Wed, Aug 07, 2019 at 04:05:53PM -0400, Marek Polacek wrote:
When implementing -Wcomma-subscript I failed to realize that a comma in
a template-argument-list shouldn't be warned about.
But we can't simply ignore any commas inside < ... > because the following
needs to be caught:
a[b < c, b > c];
This patch from Jakub fixes it by moving the warning to cp_parser_expression
where we can better detect top-level commas (and avoid saving tokens).
I've extended the patch to revert the cp_parser_skip_to_closing_square_bracket
changes I made in r274121 -- they are no longer needed.
Apologies for the thinko.
Bootstrapped/regtested on x86_64-linux, ok for trunk?