diff options
author | Ville Voutilainen <ville.voutilainen@gmail.com> | 2011-05-09 20:34:35 +0300 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-05-09 13:34:35 -0400 |
commit | b5da71d41644c40db95aabac8f67c28294f4c85f (patch) | |
tree | 704c11fb901ce576ac515237bef43408fce32e9c /gcc/cp/class.c | |
parent | 51e7f3770c99afc09afc9e9837aad4c8505fbbf8 (diff) | |
download | gcc-b5da71d41644c40db95aabac8f67c28294f4c85f.zip gcc-b5da71d41644c40db95aabac8f67c28294f4c85f.tar.gz gcc-b5da71d41644c40db95aabac8f67c28294f4c85f.tar.bz2 |
Implement final/override for member functions.
gcc/
* tree.h (TYPE_UNQUALIFIED, TYPE_QUAL_CONST): Convert to enum.
(TYPE_QUAL_VOLATILE, TYPE_QUAL_RESTRICT): Likewise.
gcc/cp/
* class.c (check_for_override): Check for DECL_OVERRIDE_P.
* cp-tree.h (DECL_OVERRIDE_P, DECL_FINAL_P): New.
(cp_virt_specifiers, enum virt_specifier): New.
* decl.c (set_virt_specifiers): New.
(grokdeclarator): Use them. Diagnose virt-specifiers on non-fields.
* parser.c (make_call_declarator): add virt-specifiers parameter.
(cp_parser_lambda_declarator_opt): Adjust.
(cp_parser_direct_declarator): Likewise.
(cp_parser_virt_specifier_seq_opt): New.
* search.c (check_final_overrider): Diagnose attempts to override
a final member function.
From-SVN: r173581
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 6b08a03..12db2bcb 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -2477,6 +2477,11 @@ check_for_override (tree decl, tree ctype) if (DECL_DESTRUCTOR_P (decl)) TYPE_HAS_NONTRIVIAL_DESTRUCTOR (ctype) = true; } + else if (DECL_OVERRIDE_P (decl)) + { + DECL_VINDEX (decl) = error_mark_node; + error ("%q+#D marked override, but does not override", decl); + } } /* Warn about hidden virtual functions that are not overridden in t. |