https://gcc.gnu.org/bugzilla/show_bug.cgi?id=17729
Kai Tietz <ktietz at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC| |ktietz at gcc dot gnu.org --- Comment #32 from Kai Tietz <ktietz at gcc dot gnu.org> --- We call function warn_deprecated_use twice within finish_id_expression. Once indirectly via mark_used, and the second time directly. So by checking if TREE_USED (t) is false this double-warning should be omitted. Testing right now following patch: Index: semantics.c =================================================================== --- semantics.c (Revision 221533) +++ semantics.c (Arbeitskopie) @@ -3649,7 +3668,7 @@ finish_id_expression (tree id_expression, /* Handle references (c++/56130). */ tree t = REFERENCE_REF_P (decl) ? TREE_OPERAND (decl, 0) : decl; - if (TREE_DEPRECATED (t)) + if (TREE_DEPRECATED (t) && !TREE_USED (t)) warn_deprecated_use (t, NULL_TREE); return decl;