re PR c++/32108 (ICE with __label__ outside of block scope)

cp/
2007-07-30  Paolo Carlini  <pcarlini@suse.de>

	PR c++/32108
	* semantics.c (finish_label_stmt): Reject the __label__
	extension outside function scopes.

testsuite/
2007-07-30  Paolo Carlini  <pcarlini@suse.de>

	PR c++/32108
	* g++.dg/ext/label6.C: New.

From-SVN: r127059
This commit is contained in:
Paolo Carlini 2007-07-30 09:37:20 +00:00 committed by Paolo Carlini
parent 5c24ddaf36
commit a6d76a9544
4 changed files with 21 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2007-07-30 Paolo Carlini <pcarlini@suse.de>
PR c++/32108
* semantics.c (finish_label_stmt): Reject the __label__
extension outside function scopes.
2007-07-29 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* parser.c (eof_token): Un-constify.

View File

@ -1343,8 +1343,13 @@ finish_label_stmt (tree name)
void
finish_label_decl (tree name)
{
tree decl = declare_local_label (name);
add_decl_expr (decl);
if (!at_function_scope_p ())
{
error ("__label__ declarations are only allowed in function scopes");
return;
}
add_decl_expr (declare_local_label (name));
}
/* When DECL goes out of scope, make sure that CLEANUP is executed. */

View File

@ -1,3 +1,8 @@
2007-07-30 Paolo Carlini <pcarlini@suse.de>
PR c++/32108
* g++.dg/ext/label6.C: New.
2007-07-29 Thomas Koenig <tkoenig@gcc.gnu.org>
PR libfortran/32858

View File

@ -0,0 +1,3 @@
// PR c++/32108
__label__ L; // { dg-error "function scopes" }