<html>
<head>
<title>P0301R0: Wording for Unified Call Syntax</title>

<style type="text/css">
  ins { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .new { text-decoration:none; font-weight:bold; background-color:#D0FFD0 }
  .rule { background-color:#FFFF40 }
  .ex { background-color: #D0FFF0 }
  del { text-decoration:line-through; background-color:#FFA0A0 }  
  strong { font-weight: inherit; color: #2020ff }
</style>
</head>

<body>
P0301R0<br/>
Jens Maurer &lt;Jens.Maurer@gmx.net><br/>
Audience: Core Working Group<br/>
2016-03-04<br/>

<h1>P0301R0: Wording for Unified Call Syntax</h1>

Split and change 5.2.2 [expr.call] paragraph 1:

<blockquote>
... [ Note: ... ]
<p>
If a function or member function name is used, the name can be
overloaded (Clause 13), in which case the appropriate function shall
be selected according to the rules in 13.3 [over.match].  <ins>If</ins>
<ul>

<li><ins>the <em>postfix-expression</em> is an unparenthesized <em>unqualified-id</em>,</ins></li>
<li><ins>lookup for that <em>unqualified-id</em> found no names or overload resolution found no viable functions (13.3.2
[over.match.viable]),</ins></li>
  
<li><ins>there is at least one argument, and</ins></li>
<li><ins>the first argument has class type,</ins></li>
</ul>

<ins>then the function call expression is equivalent to a
function call expression whose postfix expression is a class
member access expression (5.2.5 [class.mem]) with the first argument
as the object expression and the <em>unqualified-id</em> (see above)
as the <em>id-expression</em>, and whose arguments are the remaining
arguments (if any) of the original call. [ Example: </ins>

<pre class="new">
struct S {
  int f();
  static bool g();
  int h(int);
  int (*fp)();
};
int f(int);
int h(S, char *);
int h(S, int *);

int x1 = f(1);      // ok, calls ::f(int)
int x2 = f(S());    // ok, equivalent to S().f()
int x3 = ::f(S());  // error: cannot convert S to int
int x3a = (f)(S());  // error: cannot convert S to int
bool x4 = g(S());   // ok, equivalent to S().g()
int x5 = h(S(), 0); // error: ambiguous; does not consider S::h(int)
int x6 = fp(S());   // ok, equivalent to S().fp()
</pre>
<ins>-- end example]</ins>

<p>
If the selected function is non-virtual, or if the
<em>id-expression</em> in the class member access expression is a
<em>qualified-id</em>, that function is called. Otherwise, its final
overrider (10.3) in the dynamic type of the object expression is
called; such a call is referred to as a virtual function call. [ Note:
the dynamic type is the type of the object referred to by the current
value of the object expression. 12.7 describes the behavior of virtual
function calls when the object expression refers to an object under
construction or destruction. -- end note ]

</blockquote>

</body>
</html>
