aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-04-27 07:54:32 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2009-04-27 07:54:32 +0200
commit7409e5a54109beb1e249f6b25d8fae45e9c1e111 (patch)
tree968f19673bc125b699601e6421177f0ba8940329 /gcc/cp
parent5bb786b05392b26a399ad9cbf183ebfe6afd99a1 (diff)
downloadgcc-7409e5a54109beb1e249f6b25d8fae45e9c1e111.zip
gcc-7409e5a54109beb1e249f6b25d8fae45e9c1e111.tar.gz
gcc-7409e5a54109beb1e249f6b25d8fae45e9c1e111.tar.bz2
re PR c++/39875 (Wrong "value computed is not used" warning)
PR c++/39875 * cvt.c (convert_to_void) <case INDIRECT_REF>: Only warn about -Wunused-value if implicit. * g++.dg/warn/Wunused-15.C: New test. From-SVN: r146825
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/cvt.c6
2 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e15834d..3feda53 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+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.
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 6d35245..c86fbdf 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -787,7 +787,10 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
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)
@@ -885,6 +888,7 @@ 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)