<html>
<head>
<title>N3272: Follow-up on override control</title>

<style type="text/css">
  ins { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  del { text-decoration:line-through; background-color:#FFA0A0 }
</style>
</head>

<body>
Jens Maurer<br/>
N3272=11-0042<br/>
2011-03-23<br/>

<h1>N3272: Follow-up on override control</h1>

The paper N3206 "Override control: Eliminating Attributes" was voted
into the C++ Working Paper in Batavia (see also FCD National Body
comments US 44 and CA 3).
<p>
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.
<p>
This paper also addresses core issue 1063.
<p>
This paper assumes that the proposed resolution of core issue 1201 has
been applied.
<p>
Thanks to Mark Hall and Ville Voutilainen for their input.
<hr/>

Change in 8.4.1 dcl.fct.def.general paragraph 1:
<blockquote>
<pre>
<em>function-definition:
      attribute-specifier-seq<sub>opt</sub> decl-specifier-seq<sub>opt</sub> declarator <ins>virt-specifier-seq<sub>opt</sub></ins> function-body</em>
</pre>
...  The optional <em>attribute-specifier-seq</em> in a
<em>function-definition</em>
appertains to the function.
<ins>A <em>virt-specifier-seq</em> can be part of a
<em>function-definition</em> only if it is a
<em>member-declaration</em> (9.2 class.mem).</ins>
</blockquote>

Change in 9 class paragraph 1:
<blockquote>
<pre>
<em>class-head:
       class-key attribute-specifier-seq<sub>opt</sub> class-head-name class-virt-specifier<del>-seq</del><sub>opt</sub> base-clause<sub>opt</sub>
       class-key attribute-specifier-seq<sub>opt</sub> base-clause<sub>opt</sub>
...
class-virt-specifier:</em>
       final
       <del>explicit</del>
...
</pre>

<del>A <em>class-virt-specifier-seq</em> shall contain at most one of
each <em>class-virt-specifier</em>.</del>  A <em>class-specifier</em> whose
<em>class-head</em> omits the <em>class-head-name</em> defines an
unnamed class. [ Note: An unnamed class thus can't be final<del> or explicit</del>. -- end note ]

</blockquote>

<blockquote>

</blockquote>

Change in 9.2 class.mem: 
<blockquote>
<pre>
<em>member-declarator:
    declarator virt-specifier-seq<sub>opt</sub> pure-specifier<sub>opt</sub>
    declarator <del>virt-specifier-seq<sub>opt</sub></del> brace-or-equal-initializer<sub>opt</sub>
    identifier<sub>opt</sub> attribute-specifier-seq<sub>opt</sub> <del>virt-specifier-seq<sub>opt</sub></del> : constant-expression
...
virt-specifier:</em>
       override
       final
       <del>new</del>
</blockquote>

Change in 9.2 class.mem paragraph 9:
<blockquote>
A <em>virt-specifier-seq</em> shall contain at most one of each
<em>virt-specifier</em>.  <del>The <em>virt-specifier</em>s
<code>override</code> and <code>final</code></del> <ins>A
<em>virt-specifier-seq</em></ins> shall <del>only</del> appear
<ins>only</ins>
in the declaration of a virtual member function <ins>(10.3
class.virtual)</ins>.
</blockquote>

Remove 9.2 class.mem paragraph 10:
<blockquote>
<del>If a class member is marked <code>new</code> 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.</del>
</blockquote>

Remove 10 class.derived paragraph 9:

<blockquote>
<del>In a class definition marked with the <em>class-virt-specifier</em>
<code>explicit</code> ... [ Note: ... ] [ Example: ... ]</del>
</blockquote>

Change in 10.3 class.virtual paragraph 5:

<blockquote>
If a virtual function is marked with the <em>virt-specifier</em>
<code>override</code> and does not override a member function of a
base class, the program is ill-formed. [ Example:
<pre>
   struct B {
     virtual void f(<ins>int</ins>);
   };
   struct D : B {
     void f(long) override;     // error: wrong signature overriding B::f
     void f(int) override;      // OK
   };
</pre>
-- end example ]

</blockquote>

</body>
</html>
