c++: Fix misuse of "override" in -Weffc++ warnings (PR 94698)

These warnings have nothing to do with virtual functions, so "override"
is inappropriate. The warnings are just talking about defining special
members, so let's say that.

	PR translation/94698
	* class.c (check_field_decls): Change "override" to "define" in
	-Weffc++ diagnostics.
This commit is contained in:
Jonathan Wakely 2020-04-22 18:02:38 +01:00
parent 808a6eadda
commit c95d1dd7f5
2 changed files with 8 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2020-04-22 Jonathan Wakely <jwakely@redhat.com>
PR translation/94698
* class.c (check_field_decls): Change "override" to "define" in
-Weffc++ diagnostics.
2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
PR c++/94682

View file

@ -3838,13 +3838,13 @@ check_field_decls (tree t, tree *access_decls,
if (! TYPE_HAS_COPY_CTOR (t))
{
warning (OPT_Weffc__,
" but does not override %<%T(const %T&)%>", t, t);
" but does not define %<%T(const %T&)%>", t, t);
if (!TYPE_HAS_COPY_ASSIGN (t))
warning (OPT_Weffc__, " or %<operator=(const %T&)%>", t);
}
else if (! TYPE_HAS_COPY_ASSIGN (t))
warning (OPT_Weffc__,
" but does not override %<operator=(const %T&)%>", t);
" but does not define %<operator=(const %T&)%>", t);
inform (DECL_SOURCE_LOCATION (pointer_member),
"pointer member %q+D declared here", pointer_member);
}