C++ PATCH for c++/91391 - bogus -Wcomma-subscript warning

Jason Merrill jason@redhat.com
Wed Aug 14 15:06:00 GMT 2019


On 8/14/19 9:15 AM, Marek Polacek wrote:
> Ping.
> 
> 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?

OK.

Jason



More information about the Gcc-patches mailing list