This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-04-18


816. Diagnosing violations of [[final]]

Section: _N3225_.7.6.4  [dcl.attr.final]     Status: CD2     Submitter: UK     Date: 3 March, 2009

N2800 comment UK 108

[Voted into WP at July, 2009 meeting.]

According to _N3225_.7.6.4 [dcl.attr.final] paragraph 2, overriding a virtual function with the [[final]] attribute renders a program ill-formed, but no diagnostic is required. This is easily diagnosable and a diagnostic should be required in this case.

Notes from the March, 2009 meeting:

This specification was a deliberate decision on the part of the EWG; the general rule was that it should be possible to ignore attributes without changing the meaning of a program. However, the consensus of the CWG was that violation of the [[final]] attribute should require a diagnostic.

Proposed resolution (March, 2009):

Change _N3225_.7.6.4 [dcl.attr.final] paragraph 2 as follows:

If a virtual member function f in some class B is marked final and in a class D derived from B a function D::f overrides B::f, the program is ill-formed; no diagnostic required. [Footnote: If an implementation does not emit a diagnostic it should execute the program as if final were not present. —end footnote]