mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-09 12:27:12 +08:00
re PR c++/4206 (ICE with switch in while)
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. From-SVN: r46992
This commit is contained in:
parent
4a4ae92254
commit
b02922a4e3
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
27
gcc/testsuite/g++.dg/ext/forscope1.C
Normal file
27
gcc/testsuite/g++.dg/ext/forscope1.C
Normal file
@ -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;
|
||||
}
|
27
gcc/testsuite/g++.dg/ext/forscope2.C
Normal file
27
gcc/testsuite/g++.dg/ext/forscope2.C
Normal file
@ -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" "" }
|
||||
}
|
25
gcc/testsuite/g++.dg/other/forscope1.C
Normal file
25
gcc/testsuite/g++.dg/other/forscope1.C
Normal file
@ -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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user