This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch] PR 32108


Paolo Carlini wrote:

> the issue here seems indeed rather simple. I'm only slightly nervous
> about the semantics of 'at_function_scope_p' exactly matching the
> documentation, which talks about "GCC allows you to declare local labels
> in any nested block scope". Otherwise, with the minimal patch the
> testcase is rejected consistently with the C front-end and issuing a
> consistent error message.

What does it say, exactly?  I think it would be better to call
cp_parser_label_declaration (just as we do now), but have
finish_label_decl issue an error message.  Then, you can say "__label__
declarations are only allowed in function scopes".

The tricky case here will be my least-favorite GNU extension: statement
expressions.  Consider:

  void f(int i = ({ __label__ f; ... }))

This should probably be allowed.  But, I bet that in_function_scope_p
will return false when parsing the statement expression.  You will have
to try it and see...

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]