diff options
author | Jakub Jelinek <jakub@redhat.com> | 2002-02-08 08:51:19 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2002-02-08 08:51:19 +0100 |
commit | 1cf537c53e28cae8f35fb516847f7361e3098c64 (patch) | |
tree | 3b6d2649163ab940f0abbf0bd184ff1bb3ee5c17 /gcc/cp | |
parent | 8f94053d3274ffe6cddba040ed6e42a350df22b8 (diff) | |
download | gcc-1cf537c53e28cae8f35fb516847f7361e3098c64.zip gcc-1cf537c53e28cae8f35fb516847f7361e3098c64.tar.gz gcc-1cf537c53e28cae8f35fb516847f7361e3098c64.tar.bz2 |
c-common.c (c_expand_expr): Revert 2002-02-06 patch.
* c-common.c (c_expand_expr): Revert 2002-02-06 patch.
* c-parse.in (compstmt): Clear last_expr_type.
* parse.y (primary, primary_no_id): Use compstmt_or_stmtexpr
instead of compstmt.
(compstmt_or_stmtexpr): Renamed from compstmt.
(compstmt): In addition to compstmt_or_stmtexpr clear last_expr_type.
* gcc.c-torture/execute/20020206-1.c: Test whether nesting 2
expression statements work instead.
* gcc.dg/noncompile/20020207-1.c: New test.
From-SVN: r49609
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/parse.y | 11 |
2 files changed, 15 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index ad7dd54..25bf9d9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2002-02-08 Jakub Jelinek <jakub@redhat.com> + + * parse.y (primary, primary_no_id): Use compstmt_or_stmtexpr + instead of compstmt. + (compstmt_or_stmtexpr): Renamed from compstmt. + (compstmt): In addition to compstmt_or_stmtexpr clear last_expr_type. + 2002-02-07 Nathan Sidwell <nathan@codesourcery.com> Rename instantiate_type_flags to tsubst_flags_t & expand use. diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 7941a89..7faeaba 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -1592,7 +1592,7 @@ primary: pedwarn ("ISO C++ forbids braced-groups within expressions"); $<ttype>$ = begin_stmt_expr (); } - compstmt ')' + compstmt_or_stmtexpr ')' { $$ = finish_stmt_expr ($<ttype>2); } /* Koenig lookup support We could store lastiddecl in $1 to avoid another lookup, @@ -1717,7 +1717,7 @@ primary_no_id: YYERROR; } $<ttype>$ = expand_start_stmt_expr (); } - compstmt ')' + compstmt_or_stmtexpr ')' { if (pedantic) pedwarn ("ISO C++ forbids braced-groups within expressions"); $$ = expand_end_stmt_expr ($<ttype>2); } @@ -3324,7 +3324,7 @@ label_decl: } ; -compstmt: +compstmt_or_stmtexpr: save_lineno '{' { $<ttype>$ = begin_compound_stmt (0); } compstmtend @@ -3332,6 +3332,11 @@ compstmt: finish_compound_stmt (0, $<ttype>3); } ; +compstmt: + compstmt_or_stmtexpr + { last_expr_type = NULL_TREE; } + ; + simple_if: IF { $<ttype>$ = begin_if_stmt (); |