This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ Patch] PR 32108
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Paolo Carlini <pcarlini at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 16 Jul 2007 21:30:10 -0700
- Subject: Re: [C++ Patch] PR 32108
- References: <46960B4C.6070407@suse.de>
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