class.c (check_for_override): Wrap the 'final' and 'override' keywords in %< and %>.

/cp
2014-07-07  Paolo Carlini  <paolo.carlini@oracle.com>

	* class.c (check_for_override): Wrap the 'final' and 'override'
	keywords in %< and %>.

/testsuite
2014-07-07  Paolo Carlini  <paolo.carlini@oracle.com>

	* g++.dg/cpp0x/override1.C: Tweak expected error messages.

From-SVN: r212333
This commit is contained in:
Paolo Carlini 2014-07-07 15:29:01 +00:00
parent 0f05a19962
commit 8895d9a1d2
4 changed files with 17 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2014-07-07 Paolo Carlini <paolo.carlini@oracle.com>
* class.c (check_for_override): Wrap the 'final' and 'override'
keywords in %< and %>.
2014-07-06 Marek Polacek <polacek@redhat.com>
PR c/6940

View File

@ -2771,9 +2771,9 @@ check_for_override (tree decl, tree ctype)
TYPE_HAS_NONTRIVIAL_DESTRUCTOR (ctype) = true;
}
else if (DECL_FINAL_P (decl))
error ("%q+#D marked final, but is not virtual", decl);
error ("%q+#D marked %<final%>, but is not virtual", decl);
if (DECL_OVERRIDE_P (decl) && !overrides_found)
error ("%q+#D marked override, but does not override", decl);
error ("%q+#D marked %<override%>, but does not override", decl);
}
/* Warn about hidden virtual functions that are not overridden in t.

View File

@ -1,4 +1,8 @@
2014-06-24 Max Ostapenko <m.ostapenko@partner.samsung.com>
2014-07-07 Paolo Carlini <paolo.carlini@oracle.com>
* g++.dg/cpp0x/override1.C: Tweak expected error messages.
2014-07-07 Max Ostapenko <m.ostapenko@partner.samsung.com>
* c-c++-common/asan/no-redundant-instrumentation-9.c: New test.

View File

@ -18,7 +18,7 @@ struct D : B
template <class T> struct D2 : T
{
void h() override {} // { dg-error "marked override, but does not override" }
void h() override {} // { dg-error "marked 'override', but does not override" }
};
template <class T> struct D3 : T
@ -38,14 +38,14 @@ struct B3
struct B4
{
void f() final {} // { dg-error "marked final, but is not virtual" }
void f() final {} // { dg-error "marked 'final', but is not virtual" }
};
struct D5 : B
{
void ff() override {} // { dg-error "marked override, but does not override" }
virtual void fff() override {} // { dg-error "marked override, but does not override" }
virtual void x() override {} // { dg-error "marked override, but does not override" }
void ff() override {} // { dg-error "marked 'override', but does not override" }
virtual void fff() override {} // { dg-error "marked 'override', but does not override" }
virtual void x() override {} // { dg-error "marked 'override', but does not override" }
void g() override;
};