Title
To which postfix-expressions does overload resolution apply?
Status
cd2
Section
12.2.2.2 [over.match.call]
Submitter
Jens Maurer

Created on 2008-07-29.00:00:00 last changed 179 months ago

Messages

Date: 2009-10-15.00:00:00

[Voted into WP at October, 2009 meeting.]

Date: 2009-09-15.00:00:00

Proposed resolution (September, 2009):

Replace the entirety of 12.2.2.2 [over.match.call] with the following two paragraphs:

In a function call (7.6.1.3 [expr.call])

    postfix-expression ( expression-listopt )

if the postfix-expression denotes a set of overloaded functions and/or function templates, overload resolution is applied as specified in 12.2.2.2.2 [over.call.func]. If the postfix-expression denotes an object of class type, overload resolution is applied as specified in 12.2.2.2.3 [over.call.object].

If the postfix-expression denotes the address of a set of overloaded functions and/or function templates, 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. [Note: The resolution of the address of an overload set in other contexts is described in 12.3 [over.over]. —end note]

Date: 2008-07-29.00:00:00

There are several problems with the phrasing of 12.2.2.2 [over.match.call] paragraphs 1 and 3. Paragraph 1 reads,

Recall from 7.6.1.3 [expr.call], that a function call is a postfix-expression, possibly nested arbitrarily deep in parentheses, followed by an optional expression-list enclosed in parentheses:
    ( ... (opt postfix-expression ) ... )opt ( expression-listopt )
Overload resolution is required if the postfix-expression is the name of a function, a function template (13.7.7 [temp.fct]), an object of class type, or a set of pointers-to-function.

Aside from the fact that directly addressing the reader (“Recall that...”) is stylistically incongruous with the rest of the Standard, as well as the fact that 7.6.1.3 [expr.call] doesn't mention parentheses at all, this wording does not cover member function calls: a member access expression isn't “the name” of anything. This should perhaps be reworded to refer to being either an id-expression or the id-expression in a member access expression. This could be either by using two lines in the “of the form” citation or in the discussion following the syntax reference.

In addition, paragraph 3 refers to “a postfix-expression of the form &F,” which is an oxymoron: &F is a unary-expression, not a postfix-expression. One possibility would be to explicitly include the parentheses needed in this case, i.e., “a postfix-expression of the form (&F)...”

History
Date User Action Args
2010-03-29 00:00:00adminsetstatus: dr -> cd2
2009-11-08 00:00:00adminsetmessages: + msg2469
2009-11-08 00:00:00adminsetstatus: tentatively ready -> dr
2009-09-29 00:00:00adminsetstatus: drafting -> tentatively ready
2009-03-23 00:00:00adminsetstatus: review -> drafting
2008-10-05 00:00:00adminsetmessages: + msg1769
2008-10-05 00:00:00adminsetstatus: open -> review
2008-07-29 00:00:00admincreate