[over.call.func] (original) (raw)

12 Overloading [over]

12.2 Overload resolution [over.match]

12.2.2 Candidate functions and argument lists [over.match.funcs]

12.2.2.2 Function call syntax [over.match.call]

12.2.2.2.2 Call to named function [over.call.func]

Of interest in [over.call.func] are only those function calls in which the postfix-expressionultimately contains an id-expression that denotes one or more functions.

Such apostfix-expression, perhaps nested arbitrarily deep in parentheses, has one of the following forms:

These represent two syntactic subcategories of function calls: qualified function calls and unqualified function calls.

In qualified function calls, the function is named by an id-expressionpreceded by an -> or . operator.

Since the constructA->Bis generally equivalent to(*A).B, the rest of[over] assumes, without loss of generality, that all member function calls have been normalized to the form that uses an object and the.operator.

Furthermore, [over] assumes that thepostfix-expressionthat is the left operand of the.operator has type “cv T” whereTdenotes a class.100

The function declarations found by name lookup ([class.member.lookup]) constitute the set of candidate functions.

The argument list is theexpression-listin the call augmented by the addition of the left operand of the.operator in the normalized member function call as the implied object argument ([over.match.funcs]).

In unqualified function calls, the function is named by aprimary-expression.

The function declarations found by name lookup ([basic.lookup]) constitute the set of candidate functions.

Because of the rules for name lookup, the set of candidate functions consists either entirely of non-member functions or entirely of member functions of some classT.

In the former case or if the primary-expression is the address of an overload set, the argument list is the same as theexpression-listin the call.

Otherwise, the argument list is theexpression-listin the call augmented by the addition of an implied object argument as in a qualified function call.

If the current class is, or is derived from, T, and the keywordthis ([expr.prim.this]) refers to it,

Otherwise,

[Example 1: struct C { bool a();void b() { a(); } void c(this const C&); void c() &; static void c(int = 0); void d() { c(); (C::c)(); (&(C::c))(); (&C::c)(C{}); (&C::c)(*this); (&C::c)(); } void f(this const C&);void g() const { f(); f(*this); this->f(); } static void h() { f(); f(C{}); C{}.f(); } void k(this int);operator int() const;void m(this const C& c) { c.k(); } C() pre(a()) pre(this->a()) post(a()); ~C() pre(a()) post(a()) post(this->a()); }; — _end example_]