Title
Cv-qualification of incomplete virtual function return types
Status
cd3
Section
11.7.3 [class.virtual]
Submitter
Jonathan Wakely

Created on 2011-03-03.00:00:00 last changed 130 months ago

Messages

Date: 2012-02-15.00:00:00

[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]

Date: 2011-08-15.00:00:00

Proposed resolution (August, 2011):

Change 11.7.3 [class.virtual] paragraph 8 as follows:

If the class type in the covariant return type of D::f differs from the return type that of B::f, the class type in the return type of D::f shall be complete at the point of declaration of D::f or shall be the class type D. When the overriding function...
Date: 2011-03-03.00:00:00

According to 11.7.3 [class.virtual] paragraph 8,

If the return type of D::f differs from the return type of B::f, the class type in the return type of D::f shall be complete at the point of declaration of D::f or shall be the class type D.

This provision was intended to deal with covariant return types but inadvertently affects types that vary only in cv-qualification:

    struct A;
    struct B {
        virtual const A* f();
    };
    struct D : B {
        A* f();    // ill-formed
    };
History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2012-11-03 00:00:00adminsetstatus: dr -> drwp
2012-02-27 00:00:00adminsetmessages: + msg3824
2012-02-27 00:00:00adminsetstatus: ready -> dr
2011-09-06 00:00:00adminsetmessages: + msg3482
2011-03-03 00:00:00admincreate