diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2003-09-05 08:24:28 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2003-09-05 08:24:28 +0000 |
commit | 8e1daa341261864912c3b19c87c78babd4a80edf (patch) | |
tree | ed79054903625cbc8d96d97ada515039d44845bc /gcc/cp/pt.c | |
parent | 7976070c7125db206c88126464a99a18c3886e09 (diff) | |
download | gcc-8e1daa341261864912c3b19c87c78babd4a80edf.zip gcc-8e1daa341261864912c3b19c87c78babd4a80edf.tar.gz gcc-8e1daa341261864912c3b19c87c78babd4a80edf.tar.bz2 |
re PR c++/12037 (Spurious "statement has no effect" in templates)
cp:
PR c++/12037
* cp-tree.h (COMPOUND_EXPR_OVERLOADED): New.
(build_min_non_dep): Declare.
* tree.c (build_min): Propagate TREE_SIDE_EFFECTS.
(build_min_non_dep): New.
* cvt.c (convert_to_void): Don't explicitly copy
TREE_SIDE_EFFECTS, TREE_NO_UNUSED_WARNING.
* call.c (build_new_method_call): Use build_min_non_dep.
* decl2.c (grok_array_decl): Likewise.
(build_offset_ref_call_from_tree): Likewise.
* typeck.c (finish_class_member_access_expr,
build_x_indirect_ref, build_x_binary_op, build_x_unary_op,
build_x_conditional_expr, build_x_compound_expr): Likewise.
(build_static_cast, build_reinterpret_cast,
build_const_cast): Propagate TREE_SIDE_EFFECTS inside a template.
* typeck2.c (build_x_arrow): Use build_min_non_dep.
(build_functional_cast): Propagate TREE_SIDE_EFFECTS inside a
template.
* rtti.c (build_dynamic_cast_1): Set DECL_IS_PURE.
(build_dynamic_cast): Set TREE_SIDE_EFFECTS.
* pt.c (build_non_dependent_expr): Check COMPOUND_EXPR_OVERLOADED.
testsuite:
PR c++/12037
* g++.dg/warn/noeffect4.C: New test.
From-SVN: r71108
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r-- | gcc/cp/pt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 53d483c..c163018 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11811,7 +11811,8 @@ build_non_dependent_expr (tree expr) TREE_OPERAND (expr, 0), build_non_dependent_expr (TREE_OPERAND (expr, 1)), build_non_dependent_expr (TREE_OPERAND (expr, 2))); - if (TREE_CODE (expr) == COMPOUND_EXPR) + if (TREE_CODE (expr) == COMPOUND_EXPR + && !COMPOUND_EXPR_OVERLOADED (expr)) return build (COMPOUND_EXPR, TREE_TYPE (expr), TREE_OPERAND (expr, 0), |