Title
Inappropriate use of virt-specifier
Status
cd5
Section
11.4 [class.mem]
Submitter
Richard Smith

Created on 2014-08-11.00:00:00 last changed 40 months ago

Messages

Date: 2017-11-15.00:00:00

Proposed resolution (November, 2017)

Change 11.4 [class.mem] paragraph 13 as follows:

A virt-specifier-seq shall contain at most one of each virt-specifier. A virt-specifier-seq shall appear only in the first declaration of a virtual member function (11.7.3 [class.virtual]).
Date: 2018-03-15.00:00:00

[Accepted as a DR at the March, 2018 (Jacksonville) meeting.]

The restriction in 11.4 [class.mem] paragraph 8 that a virt-specifier may appear only in the declaration of a virtual function is insufficient to rule out examples like the following:

  struct A { virtual void f(); };
  struct B { friend void A::f() final; };

  template<typename T> struct C { virtual void f() {} };
  template void C<int>::f() final;
  template<> void C<char>::f() final;

One possibility might be to require that a virt-specifier appear only on the first declaration of a function.

History
Date User Action Args
2020-12-15 00:00:00adminsetstatus: dr -> cd5
2018-04-11 00:00:00adminsetstatus: tentatively ready -> dr
2018-02-27 00:00:00adminsetmessages: + msg5864
2018-02-27 00:00:00adminsetstatus: drafting -> tentatively ready
2014-08-11 00:00:00admincreate