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


794. Base-derived conversion in member type of pointer-to-member conversion

Section: 7.3.13  [conv.mem]     Status: NAD     Submitter: CH     Date: 2009-03-03

N2800 comment CH 1

Currently both implicit (7.3.13 [conv.mem]) and explicit (7.6.1.9 [expr.static.cast]) conversions of pointers to members permit only cases in which the type of the member is the same except for cv-qualification. It would seem reasonable to allow conversions in which one member type is a base class of the other. For example:

    struct B { };
    struct D: B { };
    struct X {
        D d;
    };
    struct Y: X { };
    B Y::* pm = &X::d;  // Currently ill-formed: type of d is D, not B

(See also issue 170.)

EWG 2022-11-11

The change is plausible, but needs a paper to EWG.