===================================================================
@@ -2692,9 +2692,6 @@ finish_class_member_access_expr (tree object, tree
}
}
- if (TREE_DEPRECATED (member))
- warn_deprecated_use (member, NULL_TREE);
-
if (template_p)
check_template_keyword (member);
===================================================================
@@ -347,8 +347,6 @@ build_call_a (tree function, int n, tree *argarray
if (decl && TREE_THIS_VOLATILE (decl) && cfun && cp_function_chain)
current_function_returns_abnormally = 1;
- if (decl && TREE_DEPRECATED (decl))
- warn_deprecated_use (decl, NULL_TREE);
require_complete_eh_spec_types (fntype, decl);
if (decl && DECL_CONSTRUCTOR_P (decl))
@@ -3283,8 +3281,11 @@ build_new_function_call (tree fn, VEC(tree,gc) **a
result = error_mark_node;
}
else
- result = build_over_call (cand, LOOKUP_NORMAL, complain);
-
+ {
+ if (koenig_p && TREE_DEPRECATED (cand->fn))
+ warn_deprecated_use (cand->fn, NULL_TREE);
+ result = build_over_call (cand, LOOKUP_NORMAL, complain);
+ }
/* Free all the conversions we allocated. */
obstack_free (&conversion_obstack, p);
@@ -5018,6 +5019,10 @@ convert_like_real (conversion *convs, tree expr, t
for (i = 0; i < cand->num_convs; ++i)
cand->convs[i]->user_conv_p = true;
+ /* Warn on deprecation of the candidate conversion func. */
+ if (TREE_DEPRECATED (convfn))
+ warn_deprecated_use (convfn, NULL_TREE);
+
expr = build_over_call (cand, LOOKUP_NORMAL, complain);
/* If this is a constructor or a function returning an aggr type,
@@ -6010,11 +6015,6 @@ build_over_call (struct z_candidate *cand, int fla
ba_any, NULL);
gcc_assert (binfo && binfo != error_mark_node);
- /* Warn about deprecated virtual functions now, since we're about
- to throw away the decl. */
- if (TREE_DEPRECATED (fn))
- warn_deprecated_use (fn, NULL_TREE);
-
argarray[0] = build_base_path (PLUS_EXPR, argarray[0], binfo, 1);
if (TREE_SIDE_EFFECTS (argarray[0]))
argarray[0] = save_expr (argarray[0]);
@@ -6575,6 +6575,11 @@ build_new_method_call (tree instance, tree fns, VE
/* Now we know what function is being called. */
if (fn_p)
*fn_p = fn;
+
+ /* Check for deprecation of the function to be called. */
+ if (TREE_DEPRECATED (fn))
+ warn_deprecated_use (fn, NULL_TREE);
+
/* Build the actual CALL_EXPR. */
call = build_over_call (cand, flags, complain);
/* In an expression of the form `a->f()' where `f' turns
===================================================================
@@ -0,0 +1,9 @@
+/* PR 17729 */
+/* { dg-do compile } */
+int fun (void) __attribute__((deprecated("no fun"))) ;
+
+void foo (void)
+{
+ fun (); // { dg-bogus "int fun.* no fun.*int fun" "duplicate func. warning" }
+ // { dg-warning "'int fun..' is deprecated .declared at \[^\\)\]*.: no fun" "" { target *-*-* } 7 }
+}
===================================================================
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+
+int f1 (int, int);
+int f1 (float, int) __attribute__((deprecated("no flt, int"))) ;
+int f1 (float, float);
+
+void foo (void)
+{
+ int a, b, r;
+ float c,d;
+
+ r = f1 (a, b);
+ r = f1 (c, a); // { dg-warning "'int f1.float, int.' is deprecated .declared at \[^\\)\]*.: no flt, int" }
+ r = f1 (c, d);
+
+}
\ No newline at end of file
===================================================================
@@ -0,0 +1,20 @@
+/* PR 17729 */
+/* { dg-do compile } */
+typedef int INT1 __attribute__((deprecated("no INT1"))) ;
+
+struct _a {
+ int field1 ;
+ int field2 __attribute__((deprecated("no field2"))) ;
+ INT1 field3; /* { dg-warning "'INT1' is deprecated .declared \[^\\)\]*.: no INT1 " } */
+ INT1 field4 __attribute__((deprecated("no field4"))); /* { dg-warning "'INT1' is deprecated .declared .* no INT1 " } */
+} s;
+
+void foo (void)
+{
+ s.field1 = 1;
+ s.field2 = 2; // { dg-bogus "_a::field2.*_a::field2" "duplicate field warning" }
+ // { dg-warning "'_a::field2' is deprecated .declared at \[^\\)\]*.: no field2" "" { target *-*-* } 15 }
+ s.field3 = 3;
+ s.field4 = 4; // { dg-bogus "_a::field4.*_a::field4" "duplicate field warning" }
+ // { dg-warning "'_a::field4' is deprecated .declared at .* no field4" "" { target *-*-* } 18 }
+}