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


2381. Composite pointer type of pointers to plain and noexcept member functions

Section: 7.2.2  [expr.type]     Status: CD5     Submitter: Mike Miller     Date: 2018-06-19

[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:

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):

  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:

  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: