diff options
author | Paolo Carlini <pcarlini@suse.de> | 2007-07-30 09:37:20 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2007-07-30 09:37:20 +0000 |
commit | a6d76a9544b6873d32db7ee8445472a2deda033a (patch) | |
tree | 0e8a252c5c0d0359f7fe24e52ca3bc43a3ef72bb /gcc/cp | |
parent | 5c24ddaf36be1236f276269d356257d59ff860b3 (diff) | |
download | gcc-a6d76a9544b6873d32db7ee8445472a2deda033a.tar.gz |
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
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 24006fefdaa..8004e191493 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index b03ec2f59ae..d80cd2b1128 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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. */ |