From 1cf537c53e28cae8f35fb516847f7361e3098c64 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 8 Feb 2002 08:51:19 +0100 Subject: 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 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/parse.y | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'gcc/cp') 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 + + * 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 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"); $$ = begin_stmt_expr (); } - compstmt ')' + compstmt_or_stmtexpr ')' { $$ = finish_stmt_expr ($2); } /* Koenig lookup support We could store lastiddecl in $1 to avoid another lookup, @@ -1717,7 +1717,7 @@ primary_no_id: YYERROR; } $$ = expand_start_stmt_expr (); } - compstmt ')' + compstmt_or_stmtexpr ')' { if (pedantic) pedwarn ("ISO C++ forbids braced-groups within expressions"); $$ = expand_end_stmt_expr ($2); } @@ -3324,7 +3324,7 @@ label_decl: } ; -compstmt: +compstmt_or_stmtexpr: save_lineno '{' { $$ = begin_compound_stmt (0); } compstmtend @@ -3332,6 +3332,11 @@ compstmt: finish_compound_stmt (0, $3); } ; +compstmt: + compstmt_or_stmtexpr + { last_expr_type = NULL_TREE; } + ; + simple_if: IF { $$ = begin_if_stmt (); -- cgit v1.1