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
[Accepted as a DR at the February, 2019 meeting.]
According to 7.3.14 [conv.fctptr] paragraph 1,
A prvalue of type “pointer to member of type noexcept function” can be converted to a prvalue of type “pointer to member of type function”. The result designates the member function.
However, 7.2.2 [expr.type] paragraph 4 does not allow for this conversion in determining the composite pointer type of two pointers to member functions. The corresponding conversion is considered for pointers to non-member functions, but only qualification conversions are considered for pointers to members:
The composite pointer type of two operands p1 and p2 having types T1 and T2, respectively, where at least one is a pointer or pointer-to-member type or std::nullptr_t, is:
...
if T1 or T2 is “pointer to noexcept function” and the other type is “pointer to function”, where the function types are otherwise the same, “pointer to function”;
...
if T1 is “pointer to member of C1 of type cv1 U1” and T2 is “pointer to member of C2 of type cv2 U2” where C1 is reference-related to C2 or C2 is reference-related to C1 (9.4.4 [dcl.init.ref]), the cv-combined type of T2 and T1 or the cv-combined type of T1 and T2, respectively;
Note also that the places that refer to “composite pointer type” only refer to 7.3.13 [conv.mem] for conversions involving pointers to members, omitting any reference to 7.3.14 [conv.fctptr] for pointers to member functions. This affects 7.6.9 [expr.rel], 7.6.10 [expr.eq], and 7.6.16 [expr.cond].
Proposed resolution (February, 2019):
Change 7.2.2 [expr.type] paragraph 4 as follows:
The composite pointer type of two operands p1 and p2 having types T1 and T2, respectively, where at least one is a pointer or pointer-to-member type or std::nullptr_t, is:
...
if T1 or T2 is “pointer to member of C1 of type function”, the other type is “pointer to member of C2 of type noexcept function”, and C1 is reference-related to C2 or C2 is reference-related to C1 (9.4.4 [dcl.init.ref]), where the function types are otherwise the same, “pointer to member of C2 of type function” or “pointer to member of C1 of type function”, respectively;
if T1 is “pointer to member of C1 of type cv1
U1U” and T2 is “pointer to member of C2 of type cv2U2U”, for some non-function type U, where C1 is reference-related to C2 or C2 is reference-related to C1 (9.4.4 [dcl.init.ref]), the cv-combined type of T2 and T1 or the cv-combined type of T1 and T2, respectively;
Change 7.6.10 [expr.eq] paragraph 4 as follows:
If at least one of the operands is a pointer to member, pointer-to-member conversions (7.3.13 [conv.mem]), function pointer conversions (7.3.14 [conv.fctptr]), and qualification conversions (7.3.6 [conv.qual]) are performed on both operands to bring them to their composite pointer type (7.2 [expr.prop]). Comparing...
Change 7.6.16 [expr.cond] bullet 7.4 as follows:
Lvalue-to-rvalue (7.3.2 [conv.lval]), array-to-pointer (7.3.3 [conv.array]), and function-to-pointer (7.3.4 [conv.func]) standard conversions are performed on the second and third operands. After those conversions, one of the following shall hold:
...
One or both of the second and third operands have pointer-to-member type; pointer to member conversions (7.3.13 [conv.mem]), function pointer conversions (7.3.14 [conv.fctptr]), and qualification conversions (7.3.6 [conv.qual]) are performed to bring them to their composite pointer type (7.2 [expr.prop]). The result is of the composite pointer type.
...