diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-11-13 21:05:57 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-11-13 21:05:57 +0000 |
commit | 4da3983f1da7428707a3e3109fe2da89b592595f (patch) | |
tree | 7070a235359e569768ce78545f09ea5a0d1efab7 | |
parent | 0d2192709a00dac771a0b4cd28be33674a288f8b (diff) | |
download | gcc-4da3983f1da7428707a3e3109fe2da89b592595f.tar.gz |
cp:
PR g++/4206
* parse.y (already_scoped_stmt): Remove.
(simple_stmt, WHILE & FOR): Use implicitly_scoped_stmt.
testsuite:
* g++.dg/other/forscope1.C: New test.
* g++.dg/ext/forscope1.C: New test.
* g++.dg/ext/forscope2.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46992 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parse.y | 14 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/forscope1.C | 27 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/forscope2.C | 27 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/other/forscope1.C | 25 |
6 files changed, 93 insertions, 12 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f7b629626cd..688a55be19f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-11-13 Nathan Sidwell <nathan@codesourcery.com> + + PR g++/4206 + * parse.y (already_scoped_stmt): Remove. + (simple_stmt, WHILE & FOR): Use implicitly_scoped_stmt. + 2001-11-12 H.J. Lu <hjl@gnu.org> * cp/cvt.c (ocp_convert): Don't warn the address of a weak diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 1cf00209028..12e8e2634b5 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -1187,16 +1187,6 @@ compstmtend: | maybe_label_decls error '}' ; -already_scoped_stmt: - save_lineno '{' - { $<ttype>$ = begin_compound_stmt (1); } - compstmtend - { STMT_LINENO ($<ttype>3) = $1; - finish_compound_stmt (1, $<ttype>3); } - | save_lineno simple_stmt - { if ($2) STMT_LINENO ($2) = $1; } - ; - nontrivial_exprlist: expr_no_commas ',' expr_no_commas { $$ = tree_cons (NULL_TREE, $$, @@ -3394,7 +3384,7 @@ simple_stmt: } paren_cond_or_null { finish_while_stmt_cond ($3, $<ttype>2); } - already_scoped_stmt + implicitly_scoped_stmt { $$ = $<ttype>2; finish_while_stmt ($<ttype>2); } | DO @@ -3415,7 +3405,7 @@ simple_stmt: { finish_for_cond ($6, $<ttype>2); } xexpr ')' { finish_for_expr ($9, $<ttype>2); } - already_scoped_stmt + implicitly_scoped_stmt { $$ = $<ttype>2; finish_for_stmt ($<ttype>2); } | SWITCH diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f52f1b8c439..41e0aaca456 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2001-11-13 Nathan Sidwell <nathan@codesourcery.com> + + * g++.dg/other/forscope1.C: New test. + * g++.dg/ext/forscope1.C: New test. + * g++.dg/ext/forscope2.C: New test. + 2001-11-13 Jakub Jelinek <jakub@redhat.com> * gcc.c-torture/execute/20011113-1.c: New test. diff --git a/gcc/testsuite/g++.dg/ext/forscope1.C b/gcc/testsuite/g++.dg/ext/forscope1.C new file mode 100644 index 00000000000..fa6401a3b94 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/forscope1.C @@ -0,0 +1,27 @@ +// { dg-do compile } +// { dg-options -fno-for-scope } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 Sept 2001 <nathan@codesourcery.com> + +// Bug 4206. We were nesting SCOPE_STMTs badly. + + +struct A +{ + A (); + ~A (); +}; + + +void Go( ) +{ + for (int i = 1;;) + { + switch (1) { + default: {} + } + A d; + } + i; +} diff --git a/gcc/testsuite/g++.dg/ext/forscope2.C b/gcc/testsuite/g++.dg/ext/forscope2.C new file mode 100644 index 00000000000..b883effb255 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/forscope2.C @@ -0,0 +1,27 @@ +// { dg-do compile } +// { dg-options -fpermissive } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 Sept 2001 <nathan@codesourcery.com> + +// Bug 4206. We were nesting SCOPE_STMTs badly. + + +struct A +{ + A (); + ~A (); +}; + + +void Go( ) +{ + for (int i = 1;;) // { dg-warning "using obsolete binding" "" } + { + switch (1) { + default: {} + } + A d; + } + i; // { dg-warning "name lookup" "" } +} diff --git a/gcc/testsuite/g++.dg/other/forscope1.C b/gcc/testsuite/g++.dg/other/forscope1.C new file mode 100644 index 00000000000..e694d6f2332 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/forscope1.C @@ -0,0 +1,25 @@ +// { dg-do compile } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 4 Sept 2001 <nathan@codesourcery.com> + +// Bug 4206. We were nesting SCOPE_STMTs badly. + +struct A +{ + A (); + ~A (); +}; + + +void Go( ) +{ + while (1) + { + switch (1) { + default: {} + } + A d; + } + +} |