John Spicer <firstname.lastname@example.org>
P0846R0: ADL and Function Templates that are not Visible
In Toronto (7/2017) core reviewed Robert Haberlach's D0389R1
"template keyword in unqualified-ids". Core agreed with that the problem
presented but disagreed with the intended solution.
Instead of requiring the user to use the
a revision to the lookup rules was proposed so that a name for which a normal
lookup produces either no result or finds one or more functions
and that is followed by a
a "<" would treated as if
a function template name had been found and would cause ADL to be performed.
This proposal was brought to the Evolution group in Toronto and it received
strong support (12 | 14 | 0 | 0 | 0).
It was observed that this change could change code where you have an
overloaded < operator that accepts a function as the left-hand
operand. This case was considered as pathological case not likely enough
to be of concern.
Change 6.4.1 [basic.lookup.unquql] paragraph 3:
The lookup for an unqualified name used as the postfix-expression of a
function call is described in 6.4.2.
[ Note: For purposes of determining (during parsing) whether an expression is a
postfix-expression for a function call, the usual name lookup rules
Change 17.2 [temp.names] paragraph 2 and 3:
The rules in 6.4.2 have no effect on the syntactic interpretation of an
expression. For example,
For a template-name to be explicitly qualified by the template
arguments, the name must be
Change 17.3 [temp.arg] paragraph 7:
refer to a template.
After name lookup (6.4) finds that a name is
or that an operator-function-id or a literal- operator-id refers to a set of
overloaded functions any member of which is a function template,
if this is followed by a <, the < is always
taken as the delimiter of a
template-argument-list and never as the less-than operator.
Add a new section to Annex C.6:
in a template-id
is an overloaded function template
both non-template functions in the overload set and function templates
in the overload set ...