https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79078
Marek Polacek <mpolacek at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mpolacek at gcc dot gnu.org --- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> --- One thing we should do is to --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -12643,7 +12643,7 @@ grokparms (tree parmlist, tree *parms) if (deprecated_state != DEPRECATED_SUPPRESS) { tree deptype = type_is_deprecated (type); - if (deptype) + if (deptype && !TYPE_BEING_DEFINED (deptype)) warn_deprecated_use (deptype, NULL_TREE); } i.e. don't warn if the deprecated type is being defined. For the out of class definition like void D::f(const D&) { } it'd be nice if we could somehow walk the qualifying scopes and if DEPTYPE here: 12643 if (deprecated_state != DEPRECATED_SUPPRESS) 12644 { 12645 tree deptype = type_is_deprecated (type); 12646 if (deptype && !TYPE_BEING_DEFINED (deptype)) 12647 warn_deprecated_use (deptype, NULL_TREE); 12648 } is the same as one of the scopes, don't warn.