aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2020-03-12 14:38:42 -0400
committerPatrick Palka <ppalka@redhat.com>2020-03-13 10:30:36 -0400
commit80a13af724aedfb360893dcc16aa7cc12ca49799 (patch)
treebc95d793f4402174bed2e31fca4c5299ffcb470a /gcc/cp/call.c
parent3604480a6fe493c51d6ebd53d9b1abeebbbb828f (diff)
downloadgcc-80a13af724aedfb360893dcc16aa7cc12ca49799.zip
gcc-80a13af724aedfb360893dcc16aa7cc12ca49799.tar.gz
gcc-80a13af724aedfb360893dcc16aa7cc12ca49799.tar.bz2
c++: Redundant -Wdeprecated-declarations warning in build_over_call [PR67960]
In build_over_call, we are emitting a redundant -Wdeprecated-declarations warning about the deprecated callee function, first from mark_used and again from build_addr_func <- decay_conversion <- cp_build_addr_expr <- mark_used. It seems this second deprecation warning coming from build_addr_func will always be redundant, so we can safely use a warning_sentinel to disable it before calling build_addr_func. (And any deprecation warning that could come from build_addr_func would be for FN, so we wouldn't be suppressing too much.) gcc/cp/ChangeLog: PR c++/67960 * call.c (build_over_call): Use a warning_sentinel to disable warn_deprecated_decl before calling build_addr_func. gcc/testsuite/ChangeLog: PR c++/67960 * g++.dg/diagnostic/pr67960.C: New test. * g++.dg/diagnostic/pr67960-2.C: New test.
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 5767a8b..1715acc 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -9062,6 +9062,11 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
}
else
{
+ /* If FN is marked deprecated, then we've already issued a deprecated-use
+ warning from mark_used above, so avoid redundantly issuing another one
+ from build_addr_func. */
+ warning_sentinel w (warn_deprecated_decl);
+
fn = build_addr_func (fn, complain);
if (fn == error_mark_node)
return error_mark_node;