38 lines
1.4 KiB
Markdown
38 lines
1.4 KiB
Markdown
[diff.cpp17.temp]
|
||
|
||
# Annex C (informative) Compatibility [[diff]](./#diff)
|
||
|
||
## C.3 C++ and ISO C++ 2017 [[diff.cpp17]](diff.cpp17#temp)
|
||
|
||
### C.3.8 [[temp]](temp "13 Templates"): templates [diff.cpp17.temp]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/compatibility.tex#L1275)
|
||
|
||
**Affected subclause:** [[temp.names]](temp.names)
|
||
|
||
|
||
**Change:** An [*unqualified-id*](expr.prim.id.unqual#nt:unqualified-id "7.5.5.2 Unqualified names [expr.prim.id.unqual]") that is followed by a < and for which name lookup
|
||
finds nothing or finds a function
|
||
will be treated as a [*template-name*](temp.names#nt:template-name "13.3 Names of template specializations [temp.names]") in order to potentially cause argument-dependent lookup to be performed[.](#1.sentence-1)
|
||
|
||
|
||
|
||
|
||
**Rationale:** It was problematic to call a function template
|
||
with an explicit template argument list
|
||
via argument-dependent lookup
|
||
because of the need to have a template with the same name
|
||
visible via normal lookup[.](#1.sentence-2)
|
||
|
||
|
||
|
||
|
||
**Effect on original feature:** Previously valid code that uses a function name
|
||
as the left operand of a < operator
|
||
would become ill-formed[.](#1.sentence-3)
|
||
|
||
[*Example [1](#example-1)*: struct A {};bool operator<(void (*fp)(), A);void f() {}int main() { A a;
|
||
f < a; // ill-formed; previously well-formed(f) < a; // still well-formed} â *end example*]
|