This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-10-26
[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]
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 };
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 fromthe return typethat 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...