diff options
author | Jakub Jelinek <jakub@redhat.com> | 2009-04-27 07:54:32 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2009-04-27 07:54:32 +0200 |
commit | 7409e5a54109beb1e249f6b25d8fae45e9c1e111 (patch) | |
tree | 968f19673bc125b699601e6421177f0ba8940329 /gcc/cp/cvt.c | |
parent | 5bb786b05392b26a399ad9cbf183ebfe6afd99a1 (diff) | |
download | gcc-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/cvt.c')
-rw-r--r-- | gcc/cp/cvt.c | 6 |
1 files changed, 5 insertions, 1 deletions
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) |