+2001-08-13 Mark Mitchell <mark@codesourcery.com>
+
+ * call.c (build_over_call): Mark COMPOUND_EXPRs generated for
+ empty class assignment as having side-effects to avoid
+ spurious warnings.
+
2001-08-13 Zack Weinberg <zackw@panix.com>
* Make-lang.in (cp/except.o): Add libfuncs.h to dependencies.
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);
--- /dev/null
+// Build don't link:
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+struct E {};
+
+void f () {
+ E e1, e2;
+ e1 = e2; // We should not warn about this statement, even though no
+ // code is generated for it.
+}