Title
Composite pointer type of pointers to plain and noexcept member functions
Status
cd5
Section
7.2.2 [expr.type]
Submitter
Mike Miller

Created on 2018-06-19.00:00:00 last changed 40 months ago

Messages

Date: 2019-02-15.00:00:00

Proposed resolution (February, 2019):

  1. Change 7.2.2 [expr.type] paragraph 4 as follows:

  2. 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 U1 U” and T2 is “pointer to member of C2 of type cv2 U2 U, 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;

  3. Change 7.6.10 [expr.eq] paragraph 4 as follows:

  4. 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...
  5. Change 7.6.16 [expr.cond] bullet 7.4 as follows:

  6. 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.

    • ...

Date: 2019-02-15.00:00:00

[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].

History
Date User Action Args
2020-12-15 00:00:00adminsetmessages: + msg6372
2018-06-19 00:00:00admincreate