+2009-04-27 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/39875
+ * cvt.c (convert_to_void) <case INDIRECT_REF>: Only warn about
+ -Wunused-value if implicit.
+
2009-04-24 Ian Lance Taylor <iant@google.com>
* call.c (build_temp): Change 0 to enum constant.
make it impossible to ignore the reference return value from functions. We
issue warnings in the confusing cases.
- IMPLICIT is tells us the context of an implicit void conversion. */
+ IMPLICIT is non-NULL iff an expression is being implicitly converted; it
+ is NULL when the user is explicitly converting an expression to void via
+ a cast. When non-NULL, IMPLICIT is a string indicating the context of
+ the implicit conversion. */
tree
convert_to_void (tree expr, const char *implicit, tsubst_flags_t complain)
- automatic dereferencing of references, since the user cannot
control it. (See also warn_if_unused_value() in stmt.c.) */
if (warn_unused_value
+ && implicit
&& (complain & tf_warning)
&& !TREE_NO_WARNING (expr)
&& !is_reference)
--- /dev/null
+// PR c++/39875
+// { dg-do compile }
+// { dg-options "-Wunused-value" }
+
+int *i;
+void
+foo ()
+{
+ *i++; // { dg-warning "value computed is not used" }
+ (void) *i++; // { dg-bogus "value computed is not used" }
+}