This paper implements the current consensus of removing the "hiding" feature and the "explicit" annotation on classes. It is based on the paper N3234 "Remove explicit from class-head" by Ville Voutilainen.
This paper also addresses core issue 1063.
This paper assumes that the proposed resolution of core issue 1201 has been applied.
Thanks to Mark Hall and Ville Voutilainen for their input.
Change in 9 class paragraph 1:function-definition: attribute-specifier-seqopt decl-specifier-seqopt declarator virt-specifier-seqopt function-body... The optional attribute-specifier-seq in a function-definition appertains to the function. A virt-specifier-seq can be part of a function-definition only if it is a member-declaration (9.2 class.mem).
class-head: class-key attribute-specifier-seqopt class-head-name class-virt-specifier-seqopt base-clauseopt class-key attribute-specifier-seqopt base-clauseopt ... class-virt-specifier: finalexplicit...A class-virt-specifier-seq shall contain at most one of each class-virt-specifier.A class-specifier whose class-head omits the class-head-name defines an unnamed class. [ Note: An unnamed class thus can't be finalor explicit. -- end note ]
Change in 9.2 class.mem:
Change in 9.2 class.mem paragraph 9:member-declarator: declarator virt-specifier-seqopt pure-specifieropt declaratorvirt-specifier-seqoptbrace-or-equal-initializeropt identifieropt attribute-specifier-seqoptvirt-specifier-seqopt: constant-expression ... virt-specifier: override finalnew
A virt-specifier-seq shall contain at most one of each virt-specifier.Remove 9.2 class.mem paragraph 10:The virt-specifiersA virt-specifier-seq shalloverride
andfinal
onlyappear only in the declaration of a virtual member function (10.3 class.virtual).
Remove 10 class.derived paragraph 9:If a class member is markednew
and its name does not hide (3.3.10 basic.scope.hiding, 10.2 class.member.lookup) a class member name in a base class the program is ill-formed.
Change in 10.3 class.virtual paragraph 5:In a class definition marked with the class-virt-specifierexplicit
... [ Note: ... ] [ Example: ... ]
If a virtual function is marked with the virt-specifieroverride
and does not override a member function of a base class, the program is ill-formed. [ Example:struct B { virtual void f(int); }; struct D : B { void f(long) override; // error: wrong signature overriding B::f void f(int) override; // OK };-- end example ]