C++ Patch Pings

Nathan Sidwell nathan@codesourcery.com
Wed Mar 28 14:05:00 GMT 2007


Doug Gregor wrote:

> Interestingly enough, it *does* happen, but it's okay. There are only
> three places where we call cp_parser_enclosed_template_argument_list
> and can have '>>' changed to '>'. In all of the cases, we throw away
> the entire template argument list, either because it was erroneous
> (cp_parser_check_for_invalid_template_id and cp_parser_template_name
> act this way) or because we're replacing it with a CPP_TEMPLATE_ID
> (cp_parser_template_id does this). In either case, it's actually
> important that the change from '>>' to '>' "stick", because that '>'
> might still need to be parsed to close a new-style cast expression,
> even in an error case:
> 
>  static_cast<int<int>>(0)
> 
> After auditing these calls to
> cp_parser_enclosed_template_argument_list, I'm certain that we're
> doing the righ tthing by *not* trying to back out the change from '>>'
> to '>', and that the patch is correct as written. I've added another
> test case (see below) that tests some of the more interesting cases.

thanks for checking.  I think you should add a comment that it it's ok to (and 
needed) to change the token to '>' for the reasons you cite.

patch ok with those changes.

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



More information about the Gcc-patches mailing list