diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2003-08-18 12:55:04 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2003-08-18 12:55:04 +0000 |
commit | 303b74068a5667b688d192bc96829989f5bafc9f (patch) | |
tree | 648c5a079b6d873effc48807fb0fab2d455cdd19 /gcc/cp/semantics.c | |
parent | a2507277ed143a8f75f5a60f43541fc3d714aede (diff) | |
download | gcc-303b74068a5667b688d192bc96829989f5bafc9f.zip gcc-303b74068a5667b688d192bc96829989f5bafc9f.tar.gz gcc-303b74068a5667b688d192bc96829989f5bafc9f.tar.bz2 |
re PR c++/11957 (wrong "warning: statement has no effect")
cp:
PR c++/11957
* cp-tree.h (finish_stmt_expr): Add bool parameter.
* init.c (finish_init_stmts): Pass true to finish_stmt_expr. Don't
adjust the stmt_expr here.
(build_vec_init): Use finish_stmt_expr_expr, convert result to
array type.
* parser.c (cp_parser_primar_expression): Adjust finish_stmt_expr
call.
* pt.c (tsubst_copy): Likewise.
* semantics.c (finish_stmt_expr): Add parameter.
testsuite:
PR c++/11957
* g++.dg/warn/noeffect1.C: New test.
From-SVN: r70541
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 2316392..2997237 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1405,7 +1405,7 @@ begin_stmt_expr (void) last_expr_type = NULL_TREE; keep_next_level (1); - + return last_tree; } @@ -1469,13 +1469,12 @@ finish_stmt_expr_expr (tree expr) return result; } -/* Finish a statement-expression. RTL_EXPR should be the value - returned by the previous begin_stmt_expr; EXPR is the - statement-expression. Returns an expression representing the - statement-expression. */ +/* Finish a statement-expression. EXPR should be the value returned + by the previous begin_stmt_expr. Returns an expression + representing the statement-expression. */ tree -finish_stmt_expr (tree rtl_expr) +finish_stmt_expr (tree rtl_expr, bool has_no_scope) { tree result; tree result_stmt = last_expr_type; @@ -1496,6 +1495,7 @@ finish_stmt_expr (tree rtl_expr) result = build_min (STMT_EXPR, type, last_tree); TREE_SIDE_EFFECTS (result) = 1; + STMT_EXPR_NO_SCOPE (result) = has_no_scope; last_expr_type = NULL_TREE; |