Title
Calling an explicit object member function via an address-of-overload-set
Status
tentatively ready
Section
12.2.2.2.1 [over.match.call.general]
Submitter
Matthew House

Created on 2023-01-16.00:00:00 last changed 3 days ago

Messages

Date: 2023-01-27.23:50:39

Proposed resolution (approved by CWG 2023-01-27):

Change in 12.2.2.2.1 [over.match.call.general] paragraph 2 as follows:

If the postfix-expression is the address of an overload set, overload resolution is applied using that set as described above. If the function selected by overload resolution is a non-static an implicit object member function, the program is ill-formed.
Date: 2023-01-28.21:37:02

Subclause 12.2.2.2.1 [over.match.call.general] paragraph 2 specifies:

If the postfix-expression is the address of an overload set, overload resolution is applied using that set as described above. If the function selected by overload resolution is a non-static member function, the program is ill-formed.

However, 7.6.2.2 [expr.unary.op] paragraph 3 states that the address of an explicit object member function is a plain pointer to function, not a pointer to member. The former can be invoked using the regular function call syntax (7.6.1.3 [expr.call]) without the need for a pointer-to-member expression (7.6.4 [expr.mptr.oper]). For example, absent any overloading and given some function f, the expression (&A::f)(A()) could be valid if f is a static member function or an explicit object member function. However, that expression cannot possibly be valid if f is an implicit object member function.

History
Date User Action Args
2023-01-27 23:50:39adminsetstatus: open -> tentatively ready
2023-01-16 21:15:52adminsetmessages: + msg7143
2023-01-16 00:00:00admincreate