aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2001-08-13 21:07:22 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2001-08-13 21:07:22 +0000
commit63d6f87a6d1eae6411542567d6834c27c4509f40 (patch)
treeb3d6a8ca44a45cf8cd9364a50503a60ba3fc29a9 /gcc/cp/call.c
parent7db19937237a4ae5d1cae179a1614f3294c9d3cc (diff)
downloadgcc-63d6f87a6d1eae6411542567d6834c27c4509f40.zip
gcc-63d6f87a6d1eae6411542567d6834c27c4509f40.tar.gz
gcc-63d6f87a6d1eae6411542567d6834c27c4509f40.tar.bz2
call.c (build_over_call): Mark COMPOUND_EXPRs generated for empty class assignment as having side-effects...
* call.c (build_over_call): Mark COMPOUND_EXPRs generated for empty class assignment as having side-effects to avoid spurious warnings. From-SVN: r44868
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 6278095..8203032 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4292,6 +4292,15 @@ build_over_call (cand, args, flags)
TREE_USED (arg) = 1;
val = build (COMPOUND_EXPR, DECL_CONTEXT (fn), arg, to);
+ /* Even though the assignment may not actually result in any
+ code being generated, we do not want to warn about the
+ assignment having no effect. That would be confusing to
+ users who may be performing the assignment as part of a
+ generic algorithm, for example.
+
+ Ideally, the notions of having side-effects and of being
+ useless would be orthogonal. */
+ TREE_SIDE_EFFECTS (val) = 1;
}
else
val = build (MODIFY_EXPR, TREE_TYPE (to), to, arg);