Files
2025-10-25 03:02:53 +03:00

38 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[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 "13Templates"): 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.2Unqualified 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.3Names 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*]