PATCH: PR c++/28301: [4.3/4.4/4.5 regression] ICE with broken specialization

Jason Merrill jason@redhat.com
Fri Apr 10 14:12:00 GMT 2009


H.J. Lu wrote:
> On Tue, Mar 31, 2009 at 10:36 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
>> When we see an error, we shouldn't skip to the the end of block or
>> statement if we are already at the end of block or statement.

It seems like the problem is that most places that call 
cp_parser_skip_to_end_of_block_or_statement still want to see the 
closing brace; cp_parser_save_member_function_body is the only 
exception, and in that case we start with an open brace.

Would it work to do

         case CPP_CLOSE_BRACE:
           /* Stop if this is an unnested '}', or closes the outermost 

              nesting level.  */
           nesting_depth--;
+         if (nesting_depth < 0)
+           return;
           if (!nesting_depth)
             nesting_depth = -1;
           break;

so in cases where we see a close brace without an open brace, we return 
without consuming it, but if we did see the open brace, we consume it 
and then return?

Jason



More information about the Gcc-patches mailing list