aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parse.y14
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/ext/forscope1.C27
-rw-r--r--gcc/testsuite/g++.dg/ext/forscope2.C27
-rw-r--r--gcc/testsuite/g++.dg/other/forscope1.C25
6 files changed, 93 insertions, 12 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f7b6296..688a55b 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 1cf0020..12e8e26 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 f52f1b8..41e0aac 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 0000000..fa6401a
--- /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 0000000..b883eff
--- /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 0000000..e694d6f
--- /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;
+ }
+
+}