Commit d49b251f by Marek Polacek Committed by Marek Polacek

PR c++/78010 - bogus -Wsuggest-override warning on final function.

	* class.c (check_for_override): Don't warn for final functions.

	* g++.dg/warn/Wsuggest-override-2.C: New test.

From-SVN: r271065
parent 93d2b703
2019-05-10 Marek Polacek <polacek@redhat.com>
PR c++/78010 - bogus -Wsuggest-override warning on final function.
* class.c (check_for_override): Don't warn for final functions.
2019-05-10 Jakub Jelinek <jakub@redhat.com>
PR pch/90326
......
......@@ -2780,7 +2780,9 @@ check_for_override (tree decl, tree ctype)
{
DECL_VINDEX (decl) = decl;
overrides_found = true;
if (warn_override && !DECL_OVERRIDE_P (decl)
if (warn_override
&& !DECL_OVERRIDE_P (decl)
&& !DECL_FINAL_P (decl)
&& !DECL_DESTRUCTOR_P (decl))
warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wsuggest_override,
"%qD can be marked override", decl);
......
2019-05-10 Marek Polacek <polacek@redhat.com>
PR c++/78010 - bogus -Wsuggest-override warning on final function.
* g++.dg/warn/Wsuggest-override-2.C: New test.
2019-05-10 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/90385
......
// PR c++/78010
// { dg-options "-std=c++11 -Wsuggest-override" }
struct A {
virtual void f();
};
struct B : A {
void f() final; // { dg-bogus "can be marked override" }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment