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

1396 lines
75 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.

[over.match.funcs]
# 12 Overloading [[over]](./#over)
## 12.2 Overload resolution [[over.match]](over.match#funcs)
### 12.2.2 Candidate functions and argument lists [over.match.funcs]
#### [12.2.2.1](#general) General [[over.match.funcs.general]](over.match.funcs.general)
[1](#general-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L145)
The subclauses of [over.match.funcs] describe
the set of candidate functions and the argument list submitted to
overload resolution in each context in which
overload resolution is used[.](#general-1.sentence-1)
The source transformations and constructions defined
in these subclauses are only for the purpose of describing the
overload resolution process[.](#general-1.sentence-2)
An implementation is not required
to use such transformations and constructions[.](#general-1.sentence-3)
[2](#general-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L156)
The set of candidate functions can contain both member and non-member
functions to be resolved against the same argument list[.](#general-2.sentence-1)
If a member function is
- [(2.1)](#general-2.1)
an implicit object member function that is not a constructor, or
- [(2.2)](#general-2.2)
a static member function and
the argument list includes an implied object argument,
it is considered to have an extra first parameter,
called the [*implicit object parameter*](#def:object_parameter,implicit "12.2.2.1General[over.match.funcs.general]"),
which represents the object for which the member function has been called[.](#general-2.sentence-2)
[3](#general-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L173)
Similarly, when appropriate, the context can construct an
argument list that contains an[*implied object argument*](#def:implied_object_argument "12.2.2.1General[over.match.funcs.general]") as the first argument in the list to denote
the object to be operated on[.](#general-3.sentence-1)
[4](#general-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L180)
For implicit object member functions, the type of the implicit object
parameter is
- [(4.1)](#general-4.1)
“lvalue reference to cv X” for functions declared
without a [*ref-qualifier*](dcl.decl.general#nt:ref-qualifier "9.3.1General[dcl.decl.general]") or with the& [*ref-qualifier*](dcl.decl.general#nt:ref-qualifier "9.3.1General[dcl.decl.general]")
- [(4.2)](#general-4.2)
“rvalue reference to cv X” for functions declared with the&& [*ref-qualifier*](dcl.decl.general#nt:ref-qualifier "9.3.1General[dcl.decl.general]")
whereX is the class of which the function is a direct member andcv is the cv-qualification on the
member function declaration[.](#general-4.sentence-1)
[*Example [1](#general-example-1)*:
For aconst member
function of classX,
the extra parameter is assumed to have type
“lvalue reference toconst X”[.](#general-4.sentence-2)
— *end example*]
For conversion functions that are implicit object member functions,
the function is considered to be a member of the
class of the implied object argument for the purpose of defining the
type of the implicit object parameter[.](#general-4.sentence-3)
For non-conversion functions that are implicit object member functions
nominated by a [*using-declaration*](namespace.udecl#nt:using-declaration "9.10The using declaration[namespace.udecl]") in a derived class, the function is
considered to be a member of the derived class for the purpose of defining
the type of the implicit object parameter[.](#general-4.sentence-4)
For static member functions, the implicit object parameter is considered
to match any object (since if the function is selected, the object is
discarded)[.](#general-4.sentence-5)
[*Note [1](#general-note-1)*:
No actual type is established for the implicit object parameter
of a static member function, and no attempt will be made to determine a
conversion sequence for that parameter ([[over.match.best]](over.match.best "12.2.4Best viable function"))[.](#general-4.sentence-6)
— *end note*]
[5](#general-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L224)
During overload resolution, the implied object argument is
indistinguishable from other arguments[.](#general-5.sentence-1)
The implicit object
parameter, however, retains its identity since
no user-defined conversions can be applied to achieve a type
match with it[.](#general-5.sentence-2)
For implicit object member functions declared without a [*ref-qualifier*](dcl.decl.general#nt:ref-qualifier "9.3.1General[dcl.decl.general]"),
even if the implicit object parameter is not const-qualified,
an rvalue can be bound to the parameter
as long as in all other respects the argument can be
converted to the type of the implicit object parameter[.](#general-5.sentence-3)
[*Note [2](#general-note-2)*:
The fact that such an argument is an rvalue does not
affect the [ranking](over.ics.rank "12.2.4.3Ranking implicit conversion sequences[over.ics.rank]") of implicit conversion sequences[.](#general-5.sentence-4)
— *end note*]
[6](#general-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L243)
Because other than in list-initialization only one user-defined conversion
is allowed
in an
implicit conversion sequence, special rules apply when selecting
the best user-defined conversion ([[over.match.best]](over.match.best "12.2.4Best viable function"), [[over.best.ics]](over.best.ics "12.2.4.2Implicit conversion sequences"))[.](#general-6.sentence-1)
[*Example [2](#general-example-2)*: class T {public: T();};
class C : T {public: C(int);};
T a = 1; // error: no viable conversion (T(C(1)) not considered) — *end example*]
[7](#general-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L264)
In each case where conversion functions of a class S are considered
for initializing an object or reference of type T,
the candidate functions include the result of a search
for the [*conversion-function-id*](class.conv.fct#nt:conversion-function-id "11.4.8.3Conversion functions[class.conv.fct]") operator T in S[.](#general-7.sentence-1)
[*Note [3](#general-note-3)*:
This search can find a specialization of
a conversion function template ([[basic.lookup]](basic.lookup "6.5Name lookup"))[.](#general-7.sentence-2)
— *end note*]
Each such case also defines sets of [*permissible types*](#def:types,permissible "12.2.2.1General[over.match.funcs.general]") for explicit and non-explicit conversion functions;
each (non-template) conversion function
that
- [(7.1)](#general-7.1)
is a non-hidden member of S,
- [(7.2)](#general-7.2)
yields a permissible type, and,
- [(7.3)](#general-7.3)
for the former set, is non-explicit
is also a candidate function[.](#general-7.sentence-3)
If initializing an object, for any permissible type cv U, any*cv2* U, *cv2* U&, or *cv2* U&& is also a permissible type[.](#general-7.sentence-4)
If the set of permissible types for explicit conversion functions is empty,
any candidates that are explicit are discarded[.](#general-7.sentence-5)
[8](#general-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L290)
In each case where a candidate is a function template, candidate
function template specializations
are generated using template argument deduction ([[temp.over]](temp.over "13.10.4Overload resolution"), [[temp.deduct]](temp.deduct "13.10.3Template argument deduction"))[.](#general-8.sentence-1)
If a constructor template or conversion function template
has an [*explicit-specifier*](dcl.fct.spec#nt:explicit-specifier "9.2.3Function specifiers[dcl.fct.spec]") whose [*constant-expression*](expr.const#nt:constant-expression "7.7Constant expressions[expr.const]") is value-dependent ([[temp.dep]](temp.dep "13.8.3Dependent names")),
template argument deduction is performed first and then,
if the context admits only candidates that
are not explicit and the generated specialization is explicit ([[dcl.fct.spec]](dcl.fct.spec "9.2.3Function specifiers")),
it will be removed from the candidate set[.](#general-8.sentence-2)
Those candidates are then handled as candidate
functions in the usual way[.](#general-8.sentence-3)[99](#footnote-99 "The process of argument deduction fully determines the parameter types of the function template specializations, i.e., the parameters of function template specializations contain no template parameter types. Therefore, except where specified otherwise, function template specializations and non-template functions ([dcl.fct]) are treated equivalently for the remainder of overload resolution.")
A given name can refer to, or a conversion can consider,
one or more function templates as well as a set of non-template functions[.](#general-8.sentence-4)
In such a case, the
candidate functions generated from each function template are combined
with the set of non-template candidate functions[.](#general-8.sentence-5)
[9](#general-9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L323)
A
defaulted move special member function ([[class.copy.ctor]](class.copy.ctor "11.4.5.3Copy/move constructors"), [[class.copy.assign]](class.copy.assign "11.4.6Copy/move assignment operator"))
that is defined as deleted
is excluded from the set of candidate functions in all contexts[.](#general-9.sentence-1)
A constructor inherited from class type C ([[class.inhctor.init]](class.inhctor.init "11.9.4Initialization by inherited constructor"))
that has a first parameter of type “reference to *cv1*€
(including such a constructor instantiated from a template)
is excluded from the set of candidate functions
when constructing an object of type *cv2* D if the argument list has exactly one argument andC is reference-related to P andP is reference-related to D[.](#general-9.sentence-2)
[*Example [3](#general-example-3)*: struct A { A(); // #1 A(A &&); // #2template<typename T> A(T &&); // #3};struct B : A {using A::A;
B(const B &); // #4 B(B &&) = default; // #5, implicitly deletedstruct X { X(X &&) = delete; } x;};extern B b1;
B b2 = static_cast<B&&>(b1); // calls #4: #1 is not viable, #2, #3, and #5 are not candidatesstruct C { operator B&&(); };
B b3 = C(); // calls #4 — *end example*]
[99)](#footnote-99)[99)](#footnoteref-99)
The process of argument deduction fully
determines the parameter types of
the
function template specializations,
i.e., the parameters of
function template specializations
contain
no template parameter types[.](#footnote-99.sentence-1)
Therefore, except where specified otherwise,
function template specializations
and non-template functions ([[dcl.fct]](dcl.fct "9.3.4.6Functions")) are treated equivalently
for the remainder of overload resolution[.](#footnote-99.sentence-2)
#### [12.2.2.2](#over.match.call) Function call syntax [[over.match.call]](over.match.call)
#### [12.2.2.2.1](#over.match.call.general) General [[over.match.call.general]](over.match.call.general)
[1](#over.match.call.general-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L362)
In a [function call](expr.call "7.6.1.3Function call[expr.call]")
[*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") ( [*expression-list*](expr.post.general#nt:expression-list "7.6.1.1General[expr.post.general]")opt )
if the [*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") names at least one function or
function template,
overload resolution is applied as specified in [[over.call.func]](#over.call.func "12.2.2.2.2Call to designated function")[.](#over.match.call.general-1.sentence-1)
If the [*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") denotes an object of class type, overload
resolution is applied as specified in [[over.call.object]](#over.call.object "12.2.2.2.3Call to object of class type")[.](#over.match.call.general-1.sentence-2)
[2](#over.match.call.general-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L373)
If the [*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") is the address of an overload set,
overload resolution is applied using that set as described above[.](#over.match.call.general-2.sentence-1)
[*Note [1](#over.match.call.general-note-1)*:
No implied object argument is added in this case[.](#over.match.call.general-2.sentence-2)
— *end note*]
If the function selected by overload resolution is
an implicit object member function,
the program is ill-formed[.](#over.match.call.general-2.sentence-3)
[*Note [2](#over.match.call.general-note-2)*:
The resolution of the address of an
overload set in other contexts is described in [[over.over]](over.over "12.3Address of an overload set")[.](#over.match.call.general-2.sentence-4)
— *end note*]
#### [12.2.2.2.2](#over.call.func) Call to designated function [[over.call.func]](over.call.func)
[1](#over.call.func-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L389)
Of interest in [[over.call.func]](#over.call.func "12.2.2.2.2Call to designated function") are only those function calls
in which the [*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") ultimately contains
an [*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1General[expr.prim.id.general]") or [*splice-expression*](expr.prim.splice#nt:splice-expression "7.5.9Expression splicing[expr.prim.splice]") that designates one or more functions[.](#over.call.func-1.sentence-1)
Such a[*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]"),
perhaps nested arbitrarily deep in
parentheses, has one of the following forms:
[*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]"):
[*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") . [*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1General[expr.prim.id.general]")
[*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") . [*splice-expression*](expr.prim.splice#nt:splice-expression "7.5.9Expression splicing[expr.prim.splice]")
[*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") -> [*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1General[expr.prim.id.general]")
[*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") -> [*splice-expression*](expr.prim.splice#nt:splice-expression "7.5.9Expression splicing[expr.prim.splice]")
[*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1General[expr.prim.id.general]")
[*splice-expression*](expr.prim.splice#nt:splice-expression "7.5.9Expression splicing[expr.prim.splice]")
These represent two syntactic subcategories of function calls:
qualified function calls and unqualified function calls[.](#over.call.func-1.sentence-3)
[2](#over.call.func-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L411)
In qualified function calls,
the function is designated by
an [*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1General[expr.prim.id.general]") or [*splice-expression*](expr.prim.splice#nt:splice-expression "7.5.9Expression splicing[expr.prim.splice]") E preceded by an -> or . operator[.](#over.call.func-2.sentence-1)
Since the
constructA->B is generally equivalent to(*A).B,
the rest of[[over]](over "12Overloading") assumes, without loss of generality, that all member
function calls have been normalized to the form that uses an
object and the. operator[.](#over.call.func-2.sentence-2)
Furthermore, [[over]](over "12Overloading") assumes that
the[*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") that is the left operand of the. operator
has type “cv T”
whereT denotes a class[.](#over.call.func-2.sentence-3)[100](#footnote-100 "Note that cv-qualifiers on the type of objects are significant in overload resolution for both glvalue and class prvalue objects.")
The set of candidate functions either
is the set found by name lookup ([[class.member.lookup]](class.member.lookup "6.5.2Member name lookup"))
if E is an [*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1General[expr.prim.id.general]") or
is the set determined as specified in [[expr.prim.splice]](expr.prim.splice "7.5.9Expression splicing") if E is a [*splice-expression*](expr.prim.splice#nt:splice-expression "7.5.9Expression splicing[expr.prim.splice]")[.](#over.call.func-2.sentence-4)
The argument list is the[*expression-list*](expr.post.general#nt:expression-list "7.6.1.1General[expr.post.general]") in 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])[.](#over.call.func-2.sentence-5)
[3](#over.call.func-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L456)
In unqualified function calls, the function is designated by
an [*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1General[expr.prim.id.general]") or a [*splice-expression*](expr.prim.splice#nt:splice-expression "7.5.9Expression splicing[expr.prim.splice]") E[.](#over.call.func-3.sentence-1)
The set of candidate functions either
is the set found by name lookup ([[basic.lookup]](basic.lookup "6.5Name lookup"))
if E is an [*id-expression*](expr.prim.id.general#nt:id-expression "7.5.5.1General[expr.prim.id.general]") or
is the set determined as specified in [[expr.prim.splice]](expr.prim.splice "7.5.9Expression splicing") if E is a [*splice-expression*](expr.prim.splice#nt:splice-expression "7.5.9Expression splicing[expr.prim.splice]")[.](#over.call.func-3.sentence-2)
The set of candidate functions
consists either entirely of non-member functions or entirely of
member functions of some classT[.](#over.call.func-3.sentence-3)
In the former case or
if E is either a [*splice-expression*](expr.prim.splice#nt:splice-expression "7.5.9Expression splicing[expr.prim.splice]") or
the address of an overload set,
the argument list is
the same as the[*expression-list*](expr.post.general#nt:expression-list "7.6.1.1General[expr.post.general]") in the call[.](#over.call.func-3.sentence-4)
Otherwise, the argument list is the[*expression-list*](expr.post.general#nt:expression-list "7.6.1.1General[expr.post.general]") in the call augmented by the addition of an implied object
argument as in a qualified function call[.](#over.call.func-3.sentence-5)
If the current class is, or is derived from, T, and the keywordthis ([[expr.prim.this]](expr.prim.this "7.5.3This")) refers to it,
- [(3.1)](#over.call.func-3.1)
if the unqualified function call
appears in a precondition assertion of a constructor
or a postcondition assertion of a destructor
and overload resolution selects a non-static member function,
the call is ill-formed;
- [(3.2)](#over.call.func-3.2)
otherwise,
the implied object argument is(*this)[.](#over.call.func-3.sentence-6)
Otherwise,
- [(3.3)](#over.call.func-3.3)
if overload resolution selects a non-static member function,
the call is ill-formed;
- [(3.4)](#over.call.func-3.4)
otherwise,
a contrived object of typeT becomes the implied object argument[.](#over.call.func-3.sentence-7)[101](#footnote-101 "An implied object argument is contrived to correspond to the implicit object parameter attributed to member functions during overload resolution. It is not used in the call to the selected function. Since the member functions all have the same implicit object parameter, the contrived object will not be the cause to select or reject a function.")
[*Example [1](#over.call.func-example-1)*: struct C {bool a(); void b() { a(); // OK, (*this).a()}void c(this const C&); // #1void c() &; // #2static void c(int = 0); // #3void d() { c(); // error: ambiguous between #2 and #3(C::c)(); // error: as above(&(C::c))(); // error: cannot resolve address of overloaded this->C::c ([[over.over]](over.over "12.3Address of an overload set"))(&C::c)(C{}); // selects #1(&C::c)(*this); // error: selects #2, and is ill-formed ([[over.match.call.general]](#over.match.call.general "12.2.2.2.1General"))(&C::c)(); // selects #3}void f(this const C&); void g() const { f(); // OK, (*this).f() f(*this); // error: no viable candidate for (*this).f(*this)this->f(); // OK}static void h() { f(); // error: contrived object argument, but overload resolution// picked a non-static member function f(C{}); // error: no viable candidate C{}.f(); // OK}void k(this int); operator int() const; void m(this const C& c) { c.k(); // OK} C() pre(a()) // error: implied this in constructor precondition pre(this->a()) // OK post(a()); // OK~C() pre(a()) // OK post(a()) // error: implied this in destructor postcondition post(this->a()); // OK}; — *end example*]
[100)](#footnote-100)[100)](#footnoteref-100)
Note that cv-qualifiers on the type of objects are
significant in overload
resolution for
both glvalue and class prvalue objects[.](#footnote-100.sentence-1)
[101)](#footnote-101)[101)](#footnoteref-101)
An implied object argument is contrived to
correspond to the implicit object
parameter attributed to member functions during overload resolution[.](#footnote-101.sentence-1)
It is not
used in
the call to the selected function[.](#footnote-101.sentence-2)
Since the member functions all have the
same implicit
object parameter, the contrived object will not be the cause to select or
reject a
function[.](#footnote-101.sentence-3)
#### [12.2.2.2.3](#over.call.object) Call to object of class type [[over.call.object]](over.call.object)
[1](#over.call.object-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L573)
If the [*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1General[expr.post.general]") E in the function call syntax evaluates
to a class object of type “cv T”,
then the set of candidate functions
includes at least the function call operators of T[.](#over.call.object-1.sentence-1)
The function call operators of T are the results of a search for the name operator() in the scope of T[.](#over.call.object-1.sentence-2)
[2](#over.call.object-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L583)
In addition, for each non-explicit conversion function declared in T of the
form
operator [*conversion-type-id*](class.conv.fct#nt:conversion-type-id "11.4.8.3Conversion functions[class.conv.fct]") ( ) [*cv-qualifier-seq*](dcl.decl.general#nt:cv-qualifier-seq "9.3.1General[dcl.decl.general]")opt [*ref-qualifier*](dcl.decl.general#nt:ref-qualifier "9.3.1General[dcl.decl.general]")opt [*noexcept-specifier*](except.spec#nt:noexcept-specifier "14.5Exception specifications[except.spec]")opt [*attribute-specifier-seq*](dcl.attr.grammar#nt:attribute-specifier-seq "9.13.1Attribute syntax and semantics[dcl.attr.grammar]")opt ;
where the optional[*cv-qualifier-seq*](dcl.decl.general#nt:cv-qualifier-seq "9.3.1General[dcl.decl.general]") is the same cv-qualification as, or a greater cv-qualification than,cv,
and where[*conversion-type-id*](class.conv.fct#nt:conversion-type-id "11.4.8.3Conversion functions[class.conv.fct]") denotes the type “pointer to function
of (P1,…,Pn) returning R”,
or the type “reference to pointer to function
of (P1,…,Pn) returning R”,
or the type
“reference to function of (P1,…,Pn)
returning R”, a [*surrogate call function*](#def:surrogate_call_function "12.2.2.2.3Call to object of class type[over.call.object]") with the unique name*call-function* and having the form
R *call-function* ( [*conversion-type-id*](class.conv.fct#nt:conversion-type-id "11.4.8.3Conversion functions[class.conv.fct]") F, P1 a1, …, Pn an) { return F (a1, …, an); }
is also considered as a candidate function[.](#over.call.object-2.sentence-1)
Similarly, surrogate
call functions are added to the set of candidate functions for
each non-explicit conversion function declared in a base class ofT provided the function is not hidden withinT by another
intervening declaration[.](#over.call.object-2.sentence-2)[102](#footnote-102 "Note that this construction can yield candidate call functions that cannot be differentiated one from the other by overload resolution because they have identical declarations or differ only in their return type. The call will be ambiguous if overload resolution cannot select a match to the call that is uniquely better than such undifferentiable functions.")
[3](#over.call.object-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L629)
The argument list submitted to overload resolution consists of
the argument expressions present in the function call syntax
preceded by the implied object argument(E)[.](#over.call.object-3.sentence-1)
[*Note [1](#over.call.object-note-1)*:
When comparing the
call against the function call operators, the implied object
argument is compared against the object parameter of the
function call operator[.](#over.call.object-3.sentence-2)
When comparing the call against a
surrogate call function, the implied object argument is compared
against the first parameter of the surrogate call function[.](#over.call.object-3.sentence-3)
— *end note*]
[*Example [1](#over.call.object-example-1)*: int f1(int);int f2(float);typedef int (*fp1)(int);typedef int (*fp2)(float);struct A {operator fp1() { return f1; }operator fp2() { return f2; }} a;int i = a(1); // calls f1 via pointer returned from conversion function — *end example*]
[102)](#footnote-102)[102)](#footnoteref-102)
Note that this construction can yield
candidate call functions that cannot be
differentiated one from the other by overload resolution because they have
identical
declarations or differ only in their return type[.](#footnote-102.sentence-1)
The call will be ambiguous
if overload
resolution cannot select a match to the call that is uniquely better than such
undifferentiable functions[.](#footnote-102.sentence-2)
#### [12.2.2.3](#over.match.oper) Operators in expressions [[over.match.oper]](over.match.oper)
[1](#over.match.oper-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L661)
If no operand of an operator in an expression has a type that is a class
or an enumeration, the operator is assumed to be a built-in operator
and interpreted according to [[expr.compound]](expr.compound "7.6Compound expressions")[.](#over.match.oper-1.sentence-1)
[*Note [1](#over.match.oper-note-1)*:
Because.,.*,
and:: cannot be overloaded,
these operators are always built-in operators interpreted according to[[expr.compound]](expr.compound "7.6Compound expressions")[.](#over.match.oper-1.sentence-2)
?: cannot be overloaded, but the rules in this subclause are used to determine
the conversions to be applied to the second and third operands when they
have class or enumeration type ([[expr.cond]](expr.cond "7.6.16Conditional operator"))[.](#over.match.oper-1.sentence-3)
— *end note*]
[*Example [1](#over.match.oper-example-1)*: struct String { String (const String&);
String (const char*); operator const char* ();};
String operator + (const String&, const String&);
void f() {const char* p= "one" + "two"; // error: cannot add two pointers; overloaded operator+ not considered// because neither operand has class or enumeration typeint I = 1 + 1; // always evaluates to 2 even if class or enumeration types exist// that would perform the operation.} — *end example*]
[2](#over.match.oper-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L697)
If either operand has a type that is a class or an enumeration, a
user-defined operator function can be declared that implements
this operator or a user-defined conversion can be necessary to
convert the operand to a type that is appropriate for a built-in
operator[.](#over.match.oper-2.sentence-1)
In this case, overload resolution is used to determine
which operator function or built-in operator is to be invoked to implement the
operator[.](#over.match.oper-2.sentence-2)
Therefore, the operator notation is first transformed
to the equivalent function-call notation as summarized in
Table [18](#tab:over.match.oper "Table 18: Relationship between operator and function call notation") (where @ denotes one of the operators covered in the specified subclause)[.](#over.match.oper-2.sentence-3)
However, the operands are sequenced in the order prescribed
for the built-in operator ([[expr.compound]](expr.compound "7.6Compound expressions"))[.](#over.match.oper-2.sentence-4)
Table [18](#tab:over.match.oper) — Relationship between operator and function call notation [[tab:over.match.oper]](./tab:over.match.oper)
| [🔗](#tab:over.match.oper-row-1)<br>**Subclause** | **Expression** | **As member function** | **As non-member function** |
| --- | --- | --- | --- |
| [🔗](#tab:over.match.oper-row-2)<br>[[over.unary]](over.unary "12.4.2Unary operators") | @a | (a).operator@ ( ) | operator@(a) |
| [🔗](#tab:over.match.oper-row-3)<br>[[over.binary]](over.binary "12.4.3Binary operators") | a@b | (a).operator@ (b) | operator@(a, b) |
| [🔗](#tab:over.match.oper-row-4)<br>[[over.assign]](over.assign "12.4.3.2Simple assignment") | a=b | (a).operator= (b) | |
| [🔗](#tab:over.match.oper-row-5)<br>[[over.sub]](over.sub "12.4.5Subscripting") | a[b] | (a).operator[](b) | |
| [🔗](#tab:over.match.oper-row-6)<br>[[over.ref]](over.ref "12.4.6Class member access") | a-> | (a).operator->( ) | |
| [🔗](#tab:over.match.oper-row-7)<br>[[over.inc]](over.inc "12.4.7Increment and decrement") | a@ | (a).operator@ (0) | operator@(a, 0) |
[3](#over.match.oper-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L725)
For a unary operator @ with an operand of type *cv1* T1,
and for a binary operator @ with a left operand of type *cv1* T1 and a right operand of type *cv2* T2,
four sets of candidate functions, designated[*member candidates*](#def:member_candidate "12.2.2.3Operators in expressions[over.match.oper]"),[*non-member candidates*](#def:non-member_candidate "12.2.2.3Operators in expressions[over.match.oper]"),[*built-in candidates*](#def:built-in_candidate "12.2.2.3Operators in expressions[over.match.oper]"),
and[*rewritten candidates*](#def:rewritten_candidate "12.2.2.3Operators in expressions[over.match.oper]"),
are constructed as follows:
- [(3.1)](#over.match.oper-3.1)
If T1 is a complete class type or a class currently being defined,
the set of member candidates is the result of a search foroperator@ in the scope of T1;
otherwise, the set of member candidates is empty[.](#over.match.oper-3.1.sentence-1)
- [(3.2)](#over.match.oper-3.2)
For the operators =, [], or ->,
the set of non-member candidates is empty;
otherwise, it includes the result of unqualified lookup foroperator@ in the rewritten function call ([[basic.lookup.unqual]](basic.lookup.unqual "6.5.3Unqualified name lookup"), [[basic.lookup.argdep]](basic.lookup.argdep "6.5.4Argument-dependent name lookup")),
ignoring all member functions[.](#over.match.oper-3.2.sentence-1)
However, if no operand has a class type, only those non-member
functions in the lookup set that have a first parameter of typeT1 or “reference to cv T1”,
whenT1 is an enumeration type,
or (if there is a right operand) a second parameter of typeT2 or “reference to cv T2”,
whenT2 is an enumeration type,
are candidate functions[.](#over.match.oper-3.2.sentence-2)
- [(3.3)](#over.match.oper-3.3)
For the operator,,
the unary operator&,
or the operator->,
the built-in candidates set is empty[.](#over.match.oper-3.3.sentence-1)
For all other operators, the built-in candidates include all
of the candidate operator functions defined in [[over.built]](over.built "12.5Built-in operators") that,
compared to the given operator,
* [(3.3.1)](#over.match.oper-3.3.1)
have the same operator name, and
* [(3.3.2)](#over.match.oper-3.3.2)
accept the same number of operands, and
* [(3.3.3)](#over.match.oper-3.3.3)
accept operand types to which the given operand or
operands can be converted according to [[over.best.ics]](over.best.ics "12.2.4.2Implicit conversion sequences"), and
* [(3.3.4)](#over.match.oper-3.3.4)
do not have the same parameter-type-list as any non-member candidate
or rewritten non-member candidate
that is not a function template specialization[.](#over.match.oper-3.3.sentence-2)
- [(3.4)](#over.match.oper-3.4)
The rewritten candidate set is determined as follows:
* [(3.4.1)](#over.match.oper-3.4.1)
For the relational ([[expr.rel]](expr.rel "7.6.9Relational operators")) operators,
the rewritten candidates include
all non-rewritten candidates
for the expression x <=> y[.](#over.match.oper-3.4.1.sentence-1)
* [(3.4.2)](#over.match.oper-3.4.2)
For the
relational ([[expr.rel]](expr.rel "7.6.9Relational operators")) and
three-way comparison ([[expr.spaceship]](expr.spaceship "7.6.8Three-way comparison operator"))
operators,
the rewritten candidates also include
a synthesized candidate,
with the order of the two parameters reversed,
for each non-rewritten candidate
for the expressiony <=> x[.](#over.match.oper-3.4.2.sentence-1)
* [(3.4.3)](#over.match.oper-3.4.3)
For the != operator ([[expr.eq]](expr.eq "7.6.10Equality operators")),
the rewritten candidates
include all non-rewritten candidates
for the expression x == y that are rewrite targets with first operand x (see below)[.](#over.match.oper-3.4.3.sentence-1)
* [(3.4.4)](#over.match.oper-3.4.4)
For the equality operators,
the rewritten candidates also include a synthesized candidate,
with the order of the two parameters reversed,
for each non-rewritten candidate
for the expression y == x that is a rewrite target with first operand y[.](#over.match.oper-3.4.4.sentence-1)
* [(3.4.5)](#over.match.oper-3.4.5)
For all other operators, the rewritten candidate set is empty[.](#over.match.oper-3.4.5.sentence-1)
[*Note [2](#over.match.oper-note-2)*:
A candidate synthesized from a member candidate has its
object parameter as the second parameter, thus implicit conversions
are considered for the first, but not for the second, parameter[.](#over.match.oper-3.4.sentence-2)
— *end note*]
[4](#over.match.oper-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L832)
A non-template function or function template F named operator== is a rewrite target with first operand o unless a search for the name operator!= in the scope S from the instantiation context of the operator expression
finds a function or function template
that would correspond ([[basic.scope.scope]](basic.scope.scope "6.4.1General")) to F if its name were operator==,
where S is the scope of the class type of o if F is a class member, and
the namespace scope of which F is a member otherwise[.](#over.match.oper-4.sentence-1)
A function template specialization named operator== is a rewrite target
if its function template is a rewrite target[.](#over.match.oper-4.sentence-2)
[*Example [2](#over.match.oper-example-2)*: struct A {};template<typename T> bool operator==(A, T); // #1bool a1 = 0 == A(); // OK, calls reversed #1template<typename T> bool operator!=(A, T);bool a2 = 0 == A(); // error, #1 is not a rewrite targetstruct B {bool operator==(const B&); // #2};struct C : B { C();
C(B); bool operator!=(const B&); // #3};bool c1 = B() == C(); // OK, calls #2; reversed #2 is not a candidate// because search for operator!= in C finds #3bool c2 = C() == B(); // error: ambiguous between #2 found when searching C and// reversed #2 found when searching Bstruct D {};template<typename T> bool operator==(D, T); // #4inline namespace N {template<typename T> bool operator!=(D, T); // #5}bool d1 = 0 == D(); // OK, calls reversed #4; #5 does not forbid #4 as a rewrite target — *end example*]
[5](#over.match.oper-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L875)
For the first parameter of the built-in assignment operators,
only standard conversion sequences ([[over.ics.scs]](over.ics.scs "12.2.4.2.2Standard conversion sequences")) are considered[.](#over.match.oper-5.sentence-1)
[6](#over.match.oper-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L879)
For all other operators, no such restrictions apply[.](#over.match.oper-6.sentence-1)
[7](#over.match.oper-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L882)
The set of candidate functions for overload resolution
for some operator @ is the
union of
the member candidates,
the non-member candidates,
the built-in candidates,
and the rewritten candidates
for that operator @[.](#over.match.oper-7.sentence-1)
[8](#over.match.oper-8)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L893)
The argument list contains all of the
operands of the operator[.](#over.match.oper-8.sentence-1)
The best function from the set of candidate functions is selected
according to [[over.match.viable]](over.match.viable "12.2.3Viable functions") and [[over.match.best]](over.match.best "12.2.4Best viable function")[.](#over.match.oper-8.sentence-2)[103](#footnote-103 "If the set of candidate functions is empty, overload resolution is unsuccessful.")
[*Example [3](#over.match.oper-example-3)*: struct A {operator int();};
A operator+(const A&, const A&);void m() { A a, b;
a + b; // operator+(a, b) chosen over int(a) + int(b)} — *end example*]
[9](#over.match.oper-9)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L916)
If a rewritten operator<=> candidate
is selected by overload resolution
for an operator @,x @ y is interpreted as0 @ (y <=> x) if the selected candidate is a synthesized candidate
with reversed order of parameters,
or (x <=> y) @ 0 otherwise,
using the selected rewritten operator<=> candidate[.](#over.match.oper-9.sentence-1)
Rewritten candidates for the operator @ are not considered in the context of the resulting expression[.](#over.match.oper-9.sentence-2)
[10](#over.match.oper-10)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L930)
If a rewritten operator== candidate
is selected by overload resolution
for an operator @,
its return type shall be cv bool, andx @ y is interpreted as:
- [(10.1)](#over.match.oper-10.1)
if @ is != and the selected candidate is a synthesized candidate
with reversed order of parameters,!(y == x),
- [(10.2)](#over.match.oper-10.2)
otherwise, if @ is !=,!(x == y),
- [(10.3)](#over.match.oper-10.3)
otherwise (when @ is ==),y == x,
in each case using the selected rewritten operator== candidate[.](#over.match.oper-10.sentence-1)
[11](#over.match.oper-11)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L951)
If a built-in candidate is selected by overload resolution, the
operands of class type are converted to the types of the corresponding parameters
of the selected operation function, except that the second standard conversion
sequence of a [user-defined conversion sequence](over.ics.user "12.2.4.2.3User-defined conversion sequences[over.ics.user]") is not applied[.](#over.match.oper-11.sentence-1)
Then the operator is treated as the corresponding
built-in operator and interpreted according to [[expr.compound]](expr.compound "7.6Compound expressions")[.](#over.match.oper-11.sentence-2)
[*Example [4](#over.match.oper-example-4)*: struct X {operator double();};
struct Y {operator int*();};
int *a = Y() + 100.0; // error: pointer arithmetic requires integral operandint *b = Y() + X(); // error: pointer arithmetic requires integral operand — *end example*]
[12](#over.match.oper-12)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L973)
The second operand of operator-> is ignored in selecting anoperator-> function, and is not an argument when theoperator-> function is called[.](#over.match.oper-12.sentence-1)
Whenoperator-> returns, the operator-> is applied to the value returned, with the original second
operand[.](#over.match.oper-12.sentence-2)[104](#footnote-104 "If the value returned by the operator-> function has class type, this can result in selecting and calling another operator-> function. The process repeats until an operator-> function returns a value of non-class type.")
[13](#over.match.oper-13)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L998)
If the operator is the operator,,
the unary operator&,
or the operator->,
and there are no viable functions, then the operator is
assumed to be the built-in operator and interpreted according to[[expr.compound]](expr.compound "7.6Compound expressions")[.](#over.match.oper-13.sentence-1)
[14](#over.match.oper-14)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1009)
[*Note [3](#over.match.oper-note-3)*:
The lookup rules for operators in expressions are different than
the lookup
rules for operator function names in a function call, as shown in the following
example:struct A { };void operator + (A, A);
struct B {void operator + (B); void f ();};
A a;
void B::f() {operator+ (a,a); // error: global operator hidden by member a + a; // OK, calls global operator+}
— *end note*]
[103)](#footnote-103)[103)](#footnoteref-103)
If the set of candidate functions is empty,
overload resolution is unsuccessful[.](#footnote-103.sentence-1)
[104)](#footnote-104)[104)](#footnoteref-104)
If the value returned by theoperator-> function has class type, this can result in selecting and calling anotheroperator-> function[.](#footnote-104.sentence-1)
The process repeats until anoperator-> function returns a value of non-class type[.](#footnote-104.sentence-2)
#### [12.2.2.4](#over.match.ctor) Initialization by constructor [[over.match.ctor]](over.match.ctor)
[1](#over.match.ctor-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1036)
When objects of class type are [direct-initialized](dcl.init#def:direct-initialization "9.5Initializers[dcl.init]"),
copy-initialized from an expression of the same or a
derived class type ([[dcl.init]](dcl.init "9.5Initializers")),
or [default-initialized](dcl.init#def:default-initialization "9.5Initializers[dcl.init]"),
overload resolution selects the constructor[.](#over.match.ctor-1.sentence-1)
For direct-initialization or default-initialization
(including default-initialization in the context of copy-list-initialization),
the candidate functions are
all the constructors of the class of the object being
initialized[.](#over.match.ctor-1.sentence-2)
Otherwise, the candidate functions are all
the non-explicit constructors ([[class.conv.ctor]](class.conv.ctor "11.4.8.2Conversion by constructor")) of that
class[.](#over.match.ctor-1.sentence-3)
The argument list is the[*expression-list*](expr.post.general#nt:expression-list "7.6.1.1General[expr.post.general]") or [*assignment-expression*](expr.assign#nt:assignment-expression "7.6.19Assignment and compound assignment operators[expr.assign]") of the [*initializer*](dcl.init.general#nt:initializer "9.5.1General[dcl.init.general]")[.](#over.match.ctor-1.sentence-4)
For default-initialization in the context of copy-list-initialization,
if an explicit constructor is chosen, the initialization is ill-formed[.](#over.match.ctor-1.sentence-5)
#### [12.2.2.5](#over.match.copy) Copy-initialization of class by user-defined conversion [[over.match.copy]](over.match.copy)
[1](#over.match.copy-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1059)
Under the conditions specified in [[dcl.init]](dcl.init "9.5Initializers"), as
part of a copy-initialization of an object of class type, a user-defined
conversion can be invoked to convert an initializer expression to the
type of the object being initialized[.](#over.match.copy-1.sentence-1)
Overload resolution is used
to select the user-defined conversion to be invoked[.](#over.match.copy-1.sentence-2)
[*Note [1](#over.match.copy-note-1)*:
The conversion performed for indirect binding to a reference to a possibly
cv-qualified class type is determined in terms of a corresponding non-reference
copy-initialization[.](#over.match.copy-1.sentence-3)
— *end note*]
Assuming that
“*cv1* T” is the type of the object being initialized, withT a class type,
the candidate functions are selected as follows:
- [(1.1)](#over.match.copy-1.1)
The non-explicit constructors ([[class.conv.ctor]](class.conv.ctor "11.4.8.2Conversion by constructor")) ofT are candidate functions[.](#over.match.copy-1.1.sentence-1)
- [(1.2)](#over.match.copy-1.2)
When the type of the initializer expression is a class type
“cv S”,
conversion functions are considered[.](#over.match.copy-1.2.sentence-1)
The permissible types for non-explicit conversion functions areT and any class derived from T[.](#over.match.copy-1.2.sentence-2)
When initializing a temporary object ([[class.mem]](class.mem "11.4Class members"))
to be bound to the first parameter of a constructor
where the parameter is of type
“reference to *cv2*€
and the constructor is
called with a single argument in the context of
direct-initialization of an object of type “*cv3* T”,
the permissible types for explicit conversion functions are the same;
otherwise there are none[.](#over.match.copy-1.2.sentence-3)
[2](#over.match.copy-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1098)
In both cases, the argument list has one argument, which is the initializer
expression[.](#over.match.copy-2.sentence-1)
[*Note [2](#over.match.copy-note-2)*:
This argument will be compared against
the first parameter of the constructors and against the
object parameter of the conversion functions[.](#over.match.copy-2.sentence-2)
— *end note*]
#### [12.2.2.6](#over.match.conv) Initialization by conversion function [[over.match.conv]](over.match.conv)
[1](#over.match.conv-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1110)
Under the conditions specified in [[dcl.init]](dcl.init "9.5Initializers"), as
part of an initialization of an object of non-class type,
a conversion function can be invoked to convert an initializer
expression of class type to the type of the object
being initialized[.](#over.match.conv-1.sentence-1)
Overload resolution is used to select the
conversion function to be invoked[.](#over.match.conv-1.sentence-2)
Assuming that “cv T” is the
type of the object being initialized,
the candidate functions are selected as follows:
- [(1.1)](#over.match.conv-1.1)
The permissible types for non-explicit conversion functions are
those that can be converted to type T via a standard conversion sequence ([[over.ics.scs]](over.ics.scs "12.2.4.2.2Standard conversion sequences"))[.](#over.match.conv-1.sentence-3)
For direct-initialization,
the permissible types for explicit conversion functions are
those that can be converted to type T with a (possibly trivial) qualification conversion ([[conv.qual]](conv.qual "7.3.6Qualification conversions"));
otherwise there are none[.](#over.match.conv-1.1.sentence-2)
[2](#over.match.conv-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1133)
The argument list has one argument, which is the initializer expression[.](#over.match.conv-2.sentence-1)
[*Note [1](#over.match.conv-note-1)*:
This argument will be compared against
the object parameter of the conversion functions[.](#over.match.conv-2.sentence-2)
— *end note*]
#### [12.2.2.7](#over.match.ref) Initialization by conversion function for direct reference binding [[over.match.ref]](over.match.ref)
[1](#over.match.ref-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1143)
Under the conditions specified in [[dcl.init.ref]](dcl.init.ref "9.5.4References"), a reference can be bound directly
to the result of applying a conversion
function to an initializer expression[.](#over.match.ref-1.sentence-1)
Overload resolution is used to select the
conversion function to be invoked[.](#over.match.ref-1.sentence-2)
Assuming that “reference to *cv1*€ is the
type of the reference being initialized,
the candidate functions are selected as follows:
- [(1.1)](#over.match.ref-1.1)
Let R be a set of types including
* [(1.1.1)](#over.match.ref-1.1.1)
“lvalue reference to *cv2* T2”
(when converting to an lvalue) and
* [(1.1.2)](#over.match.ref-1.1.2)
“*cv2* T2”
and “rvalue reference to *cv2* T2”
(when converting to an rvalue or an lvalue of function type)
for any T2[.](#over.match.ref-1.sentence-3)
The permissible types for non-explicit conversion functions are
the members of R where “*cv1* T” is reference-compatible ([[dcl.init.ref]](dcl.init.ref "9.5.4References"))
with “*cv2* T2”[.](#over.match.ref-1.1.sentence-2)
For direct-initialization, the permissible types for explicit
conversion functions are the members of R where T2 can be converted to type T with a (possibly trivial) qualification conversion ([[conv.qual]](conv.qual "7.3.6Qualification conversions"));
otherwise there are none[.](#over.match.ref-1.1.sentence-3)
[2](#over.match.ref-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1176)
The argument list has one argument, which is the initializer expression[.](#over.match.ref-2.sentence-1)
[*Note [1](#over.match.ref-note-1)*:
This argument will be compared against
the object parameter of the conversion functions[.](#over.match.ref-2.sentence-2)
— *end note*]
#### [12.2.2.8](#over.match.list) Initialization by list-initialization [[over.match.list]](over.match.list)
[1](#over.match.list-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1186)
When objects of non-aggregate class type T are
list-initialized such that [[dcl.init.list]](dcl.init.list "9.5.5List-initialization") specifies that overload resolution
is performed according to the rules in this subclause
or when forming a list-initialization sequence according to [[over.ics.list]](over.ics.list "12.2.4.2.6List-initialization sequence"),
overload resolution selects the constructor in two phases:
- [(1.1)](#over.match.list-1.1)
If the initializer list is not empty or T has no default constructor,
overload resolution is first performed
where the candidate functions are the initializer-list constructors ([[dcl.init.list]](dcl.init.list "9.5.5List-initialization"))
of the class T and
the argument list consists of the initializer list as a single argument[.](#over.match.list-1.1.sentence-1)
- [(1.2)](#over.match.list-1.2)
Otherwise, or if no viable initializer-list constructor is found,
overload resolution is
performed again, where the candidate functions are all the constructors of
the class T and
the argument list consists of the elements of the initializer list[.](#over.match.list-1.2.sentence-1)
In copy-list-initialization, if an explicit constructor is
chosen, the initialization is ill-formed[.](#over.match.list-1.sentence-2)
[*Note [1](#over.match.list-note-1)*:
This differs from other situations ([[over.match.ctor]](#over.match.ctor "12.2.2.4Initialization by constructor"), [[over.match.copy]](#over.match.copy "12.2.2.5Copy-initialization of class by user-defined conversion")),
where only non-explicit constructors are considered for copy-initialization[.](#over.match.list-1.sentence-3)
This restriction only
applies if this initialization is part of the final result of overload
resolution[.](#over.match.list-1.sentence-4)
— *end note*]
#### [12.2.2.9](#over.match.class.deduct) Class template argument deduction [[over.match.class.deduct]](over.match.class.deduct)
[1](#over.match.class.deduct-1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1221)
When resolving a placeholder for a deduced class type ([[dcl.type.class.deduct]](dcl.type.class.deduct "9.2.9.8Deduced class template specialization types"))
where the [*template-name*](temp.names#nt:template-name "13.3Names of template specializations[temp.names]") or [*splice-type-specifier*](dcl.type.splice#nt:splice-type-specifier "9.2.9.9Type splicing[dcl.type.splice]") designates a primary class template C,
a set of functions and function templates, called the guides of C,
is formed comprising:
- [(1.1)](#over.match.class.deduct-1.1)
If C is defined,
for each constructor of C,
a function template with the following properties:
* [(1.1.1)](#over.match.class.deduct-1.1.1)
The template parameters are the template parameters of C followed
by the template parameters (including default template arguments) of the constructor,
if any[.](#over.match.class.deduct-1.1.1.sentence-1)
* [(1.1.2)](#over.match.class.deduct-1.1.2)
The associated constraints ([[temp.constr.decl]](temp.constr.decl "13.5.3Constrained declarations")) are the conjunction of
the associated constraints of C and
the associated constraints of the constructor, if any[.](#over.match.class.deduct-1.1.2.sentence-1)
[*Note [1](#over.match.class.deduct-note-1)*:
A [*constraint-expression*](temp.constr.decl#nt:constraint-expression "13.5.3Constrained declarations[temp.constr.decl]") in
the [*template-head*](temp.pre#nt:template-head "13.1Preamble[temp.pre]") of C is checked for satisfaction before any constraints from
the [*template-head*](temp.pre#nt:template-head "13.1Preamble[temp.pre]") or trailing [*requires-clause*](temp.pre#nt:requires-clause "13.1Preamble[temp.pre]") of the constructor[.](#over.match.class.deduct-1.1.2.sentence-2)
— *end note*]
* [(1.1.3)](#over.match.class.deduct-1.1.3)
The [*parameter-declaration-clause*](dcl.fct#nt:parameter-declaration-clause "9.3.4.6Functions[dcl.fct]") is that of the constructor[.](#over.match.class.deduct-1.1.3.sentence-1)
* [(1.1.4)](#over.match.class.deduct-1.1.4)
The return type is the class template specialization
designated by C and template arguments
corresponding to the template parameters of C[.](#over.match.class.deduct-1.1.4.sentence-1)
- [(1.2)](#over.match.class.deduct-1.2)
If C is not defined or does not declare any constructors,
an additional function template derived as above
from a hypothetical constructor C()[.](#over.match.class.deduct-1.2.sentence-1)
- [(1.3)](#over.match.class.deduct-1.3)
An additional function template derived as above
from a hypothetical constructor C(C),
called the [*copy deduction candidate*](#def:copy_deduction_candidate "12.2.2.9Class template argument deduction[over.match.class.deduct]")[.](#over.match.class.deduct-1.3.sentence-1)
- [(1.4)](#over.match.class.deduct-1.4)
For each [*deduction-guide*](temp.deduct.guide#nt:deduction-guide "13.7.2.3Deduction guides[temp.deduct.guide]"),
a function or function template
with the following properties:
* [(1.4.1)](#over.match.class.deduct-1.4.1)
The [*template-head*](temp.pre#nt:template-head "13.1Preamble[temp.pre]"), if any,
and [*parameter-declaration-clause*](dcl.fct#nt:parameter-declaration-clause "9.3.4.6Functions[dcl.fct]") are those of the [*deduction-guide*](temp.deduct.guide#nt:deduction-guide "13.7.2.3Deduction guides[temp.deduct.guide]")[.](#over.match.class.deduct-1.4.1.sentence-1)
* [(1.4.2)](#over.match.class.deduct-1.4.2)
The return type
is the [*simple-template-id*](temp.names#nt:simple-template-id "13.3Names of template specializations[temp.names]") of the [*deduction-guide*](temp.deduct.guide#nt:deduction-guide "13.7.2.3Deduction guides[temp.deduct.guide]")[.](#over.match.class.deduct-1.4.2.sentence-1)
In addition, if C is defined
and its definition satisfies the conditions for
an aggregate class ([[dcl.init.aggr]](dcl.init.aggr "9.5.2Aggregates"))
with the assumption that any dependent base class has
no virtual functions and no virtual base classes, and
the initializer is a non-empty [*braced-init-list*](dcl.init.general#nt:braced-init-list "9.5.1General[dcl.init.general]") or
parenthesized [*expression-list*](expr.post.general#nt:expression-list "7.6.1.1General[expr.post.general]"), and
there are no [*deduction-guide*](temp.deduct.guide#nt:deduction-guide "13.7.2.3Deduction guides[temp.deduct.guide]")*s* for C,
the set contains an additional function template,
called the [*aggregate deduction candidate*](#def:candidate,aggregate_deduction "12.2.2.9Class template argument deduction[over.match.class.deduct]"), defined as follows[.](#over.match.class.deduct-1.sentence-2)
Let x1,…,xn be the elements
of the [*initializer-list*](dcl.init.general#nt:initializer-list "9.5.1General[dcl.init.general]") or[*designated-initializer-list*](dcl.init.general#nt:designated-initializer-list "9.5.1General[dcl.init.general]") of the [*braced-init-list*](dcl.init.general#nt:braced-init-list "9.5.1General[dcl.init.general]"), or
of the [*expression-list*](expr.post.general#nt:expression-list "7.6.1.1General[expr.post.general]")[.](#over.match.class.deduct-1.sentence-3)
For each xi, let ei be the corresponding aggregate element
of C or of one of its (possibly recursive) subaggregates
that would be initialized by xi ([[dcl.init.aggr]](dcl.init.aggr "9.5.2Aggregates")) if
- [(1.5)](#over.match.class.deduct-1.5)
brace elision is not considered for any aggregate element
that has
* [(1.5.1)](#over.match.class.deduct-1.5.1)
a dependent non-array type,
* [(1.5.2)](#over.match.class.deduct-1.5.2)
an array type with a value-dependent bound, or
* [(1.5.3)](#over.match.class.deduct-1.5.3)
an array type with a dependent array element type and xi is a string literal; and
- [(1.6)](#over.match.class.deduct-1.6)
each non-trailing aggregate element that is a pack expansion
is assumed to correspond to no elements of the initializer list, and
- [(1.7)](#over.match.class.deduct-1.7)
a trailing aggregate element that is a pack expansion is assumed to correspond
to all remaining elements of the initializer list (if any)[.](#over.match.class.deduct-1.sentence-4)
If there is no such aggregate element ei for any xi,
the aggregate deduction candidate is not added to the set[.](#over.match.class.deduct-1.sentence-5)
The aggregate deduction candidate is derived as above
from a hypothetical constructor C(T1,…,Tn),
where
- [(1.8)](#over.match.class.deduct-1.8)
if ei is of array type andxi is a [*braced-init-list*](dcl.init.general#nt:braced-init-list "9.5.1General[dcl.init.general]"),Ti is an rvalue reference to the declared type of ei, and
- [(1.9)](#over.match.class.deduct-1.9)
if ei is of array type andxi is a [*string-literal*](lex.string#nt:string-literal "5.13.5String literals[lex.string]"),Ti is an lvalue reference to
the const-qualified declared type of ei, and
- [(1.10)](#over.match.class.deduct-1.10)
otherwise, Ti is the declared type of ei,
except that additional parameter packs of the form Pj... are inserted into the parameter list in their original aggregate element position corresponding to each non-trailing aggregate element of type Pj that was skipped because it was a parameter pack, and
the trailing sequence of parameters corresponding
to a trailing aggregate element that is a pack expansion (if any)
is replaced by a single parameter of the form Tn...[.](#over.match.class.deduct-1.sentence-6)
In addition,
if C is defined and
inherits constructors ([[namespace.udecl]](namespace.udecl "9.10The using declaration"))
from a direct base class denoted in the [*base-specifier-list*](class.derived.general#nt:base-specifier-list "11.7.1General[class.derived.general]") by a [*class-or-decltype*](class.derived.general#nt:class-or-decltype "11.7.1General[class.derived.general]") B,
let A be an alias template
whose template parameter list is that of C and
whose [*defining-type-id*](dcl.name#nt:defining-type-id "9.3.2Type names[dcl.name]") is B[.](#over.match.class.deduct-1.sentence-7)
If A is a deducible template ([[dcl.type.simple]](dcl.type.simple "9.2.9.3Simple type specifiers")),
the set contains the guides of A with the return type R of each guide
replaced with typename CC<R>::type given a class templatetemplate <typename> class CC; whose primary template is not defined and
with a single partial specialization
whose template parameter list is that of A and
whose template argument list is a specialization of A with
the template argument list of A ([[temp.dep.type]](temp.dep.type "13.8.3.2Dependent types"))
having a member typedef type designating a template specialization with
the template argument list of A but
with C as the template[.](#over.match.class.deduct-1.sentence-8)
[*Note [2](#over.match.class.deduct-note-2)*:
Equivalently,
the template parameter list of the specialization is that of C,
the template argument list of the specialization is B, and
the member typedef names C with the template argument list of C[.](#over.match.class.deduct-1.sentence-9)
— *end note*]
[2](#over.match.class.deduct-2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1373)
[*Example [1](#over.match.class.deduct-example-1)*: template <typename T> struct B { B(T);};template <typename T> struct C : public B<T> {using B<T>::B;};template <typename T> struct D : public B<T> {};
C c(42); // OK, deduces C<int> D d(42); // error: deduction failed, no inherited deduction guides B(int) -> B<char>;
C c2(42); // OK, deduces C<char>template <typename T> struct E : public B<int> {using B<int>::B;};
E e(42); // error: deduction failed, arguments of E cannot be deduced from introduced guidestemplate <typename T, typename U, typename V> struct F { F(T, U, V);};template <typename T, typename U> struct G : F<U, T, int> {using G::F::F;} G g(true, 'a', 1); // OK, deduces G<char, bool>template<class T, std::size_t N>struct H { T array[N];};template<class T, std::size_t N>struct I {volatile T array[N];};template<std::size_t N>struct J {unsigned char array[N];};
H h = { "abc" }; // OK, deduces H<char, 4> (not T = const char) I i = { "def" }; // OK, deduces I<char, 4> J j = { "ghi" }; // error: cannot bind reference to array of unsigned char to array of char in deduction — *end example*]
[3](#over.match.class.deduct-3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1423)
When resolving a placeholder for a deduced class type ([[dcl.type.simple]](dcl.type.simple "9.2.9.3Simple type specifiers"))
where
the [*template-name*](temp.names#nt:template-name "13.3Names of template specializations[temp.names]") or [*splice-type-specifier*](dcl.type.splice#nt:splice-type-specifier "9.2.9.9Type splicing[dcl.type.splice]") designates an alias template A,
the [*defining-type-id*](dcl.name#nt:defining-type-id "9.3.2Type names[dcl.name]") of A must be of the form
typenameopt [*nested-name-specifier*](expr.prim.id.qual#nt:nested-name-specifier "7.5.5.3Qualified names[expr.prim.id.qual]")opt templateopt [*simple-template-id*](temp.names#nt:simple-template-id "13.3Names of template specializations[temp.names]")
as specified in [[dcl.type.simple]](dcl.type.simple "9.2.9.3Simple type specifiers")[.](#over.match.class.deduct-3.sentence-1)
The guides of A are the set of functions or function templates
formed as follows[.](#over.match.class.deduct-3.sentence-2)
For each function or function template f in the guides of
the template named by the [*simple-template-id*](temp.names#nt:simple-template-id "13.3Names of template specializations[temp.names]") of the [*defining-type-id*](dcl.name#nt:defining-type-id "9.3.2Type names[dcl.name]"),
the template arguments of the return type of f are deduced
from the [*defining-type-id*](dcl.name#nt:defining-type-id "9.3.2Type names[dcl.name]") of A according to the process in [[temp.deduct.type]](temp.deduct.type "13.10.3.6Deducing template arguments from a type") with the exception that deduction does not fail
if not all template arguments are deduced[.](#over.match.class.deduct-3.sentence-3)
If deduction fails for another reason,
proceed with an empty set of deduced template arguments[.](#over.match.class.deduct-3.sentence-4)
Let g denote the result of substituting
these deductions into f[.](#over.match.class.deduct-3.sentence-5)
If substitution succeeds,
form a function or function template f' with the following properties and add it to the set
of guides of A:
- [(3.1)](#over.match.class.deduct-3.1)
The function type of f' is the function type of g[.](#over.match.class.deduct-3.1.sentence-1)
- [(3.2)](#over.match.class.deduct-3.2)
If f is a function template,f' is a function template whose
template parameter list consists of
all the template parameters of A (including their default template arguments)
that appear in the above deductions or
(recursively) in their default template arguments,
followed by the template parameters of f that were not deduced
(including their default template arguments),
otherwise f' is not a function template[.](#over.match.class.deduct-3.2.sentence-1)
- [(3.3)](#over.match.class.deduct-3.3)
The associated constraints ([[temp.constr.decl]](temp.constr.decl "13.5.3Constrained declarations")) are
the conjunction of the associated constraints of g and
a constraint that is satisfied if and only if
the arguments of A are deducible (see below) from the return type[.](#over.match.class.deduct-3.3.sentence-1)
- [(3.4)](#over.match.class.deduct-3.4)
If f is a copy deduction candidate,
then f' is considered to be so as well[.](#over.match.class.deduct-3.4.sentence-1)
- [(3.5)](#over.match.class.deduct-3.5)
If f was generated
from a [*deduction-guide*](temp.deduct.guide#nt:deduction-guide "13.7.2.3Deduction guides[temp.deduct.guide]") ([[temp.deduct.guide]](temp.deduct.guide "13.7.2.3Deduction guides")),
then f' is considered to be so as well[.](#over.match.class.deduct-3.5.sentence-1)
- [(3.6)](#over.match.class.deduct-3.6)
The [*explicit-specifier*](dcl.fct.spec#nt:explicit-specifier "9.2.3Function specifiers[dcl.fct.spec]") of f' is
the [*explicit-specifier*](dcl.fct.spec#nt:explicit-specifier "9.2.3Function specifiers[dcl.fct.spec]") of g (if any)[.](#over.match.class.deduct-3.6.sentence-1)
[4](#over.match.class.deduct-4)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1489)
The arguments of a template A are said to be
deducible from a type T if, given a class templatetemplate <typename> class AA; with a single partial specialization
whose template parameter list is that of A and
whose template argument list is a specialization of A with the template argument list of A ([[temp.dep.type]](temp.dep.type "13.8.3.2Dependent types")),AA<T> matches the partial specialization[.](#over.match.class.deduct-4.sentence-1)
[5](#over.match.class.deduct-5)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1501)
Initialization and overload resolution are performed as described
in [[dcl.init]](dcl.init "9.5Initializers") and [[over.match.ctor]](#over.match.ctor "12.2.2.4Initialization by constructor"), [[over.match.copy]](#over.match.copy "12.2.2.5Copy-initialization of class by user-defined conversion"),
or [[over.match.list]](#over.match.list "12.2.2.8Initialization by list-initialization") (as appropriate for the type of initialization
performed) for an object of a hypothetical class type, where
the guides of the template named by the placeholder are considered to be the
constructors of that class type for the purpose of forming an overload
set, and the initializer is provided by the context in which class
template argument deduction was performed[.](#over.match.class.deduct-5.sentence-1)
The following exceptions apply:
- [(5.1)](#over.match.class.deduct-5.1)
The first phase in [[over.match.list]](#over.match.list "12.2.2.8Initialization by list-initialization") (considering initializer-list constructors)
is omitted if the initializer list consists of
a single expression of type cv U,
where U is, or is derived from,
a specialization of the class template
directly or indirectly named by the placeholder[.](#over.match.class.deduct-5.1.sentence-1)
- [(5.2)](#over.match.class.deduct-5.2)
During template argument deduction for the aggregate deduction candidate,
the number of elements in a trailing parameter pack
is only deduced from the number of remaining function arguments
if it is not otherwise deduced[.](#over.match.class.deduct-5.2.sentence-1)
If the function or function template was generated from
a constructor or [*deduction-guide*](temp.deduct.guide#nt:deduction-guide "13.7.2.3Deduction guides[temp.deduct.guide]") that had an [*explicit-specifier*](dcl.fct.spec#nt:explicit-specifier "9.2.3Function specifiers[dcl.fct.spec]"),
each such notional constructor is considered to have
that same [*explicit-specifier*](dcl.fct.spec#nt:explicit-specifier "9.2.3Function specifiers[dcl.fct.spec]")[.](#over.match.class.deduct-5.sentence-3)
All such notional constructors are considered to be
public members of the hypothetical class type[.](#over.match.class.deduct-5.sentence-4)
[6](#over.match.class.deduct-6)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1534)
[*Example [2](#over.match.class.deduct-example-2)*: template <class T> struct A {explicit A(const T&, ...) noexcept; // #1 A(T&&, ...); // #2};
int i;
A a1 = { i, i }; // error: explicit constructor #1 selected in copy-list-initialization during deduction,// cannot deduce from non-forwarding rvalue reference in #2 A a2{i, i}; // OK, #1 deduces to A<int> and also initializes A a3{0, i}; // OK, #2 deduces to A<int> and also initializes A a4 = {0, i}; // OK, #2 deduces to A<int> and also initializestemplate <class T> A(const T&, const T&) -> A<T&>; // #3template <class T> explicit A(T&&, T&&) -> A<T>; // #4 A a5 = {0, 1}; // error: explicit deduction guide #4 selected in copy-list-initialization during deduction A a6{0,1}; // OK, #4 deduces to A<int> and #2 initializes A a7 = {0, i}; // error: #3 deduces to A<int&>, #1 and #2 declare same constructor A a8{0,i}; // error: #3 deduces to A<int&>, #1 and #2 declare same constructortemplate <class T> struct B {template <class U> using TA = T; template <class U> B(U, TA<U>);};
B b{(int*)0, (char*)0}; // OK, deduces B<char*>template <typename T>struct S { T x;
T y;};
template <typename T>struct C { S<T> s;
T t;};
template <typename T>struct D { S<int> s;
T t;};
C c1 = {1, 2}; // error: deduction failed C c2 = {1, 2, 3}; // error: deduction failed C c3 = {{1u, 2u}, 3}; // OK, deduces C<int> D d1 = {1, 2}; // error: deduction failed D d2 = {1, 2, 3}; // OK, braces elided, deduces D<int>template <typename T>struct E { T t; decltype(t) t2;};
E e1 = {1, 2}; // OK, deduces E<int>template <typename... T>struct Types {};
template <typename... T>struct F : Types<T...>, T... {};
struct X {};struct Y {};struct Z {};struct W { operator Y(); };
F f1 = {Types<X, Y, Z>{}, {}, {}}; // OK, F<X, Y, Z> deduced F f2 = {Types<X, Y, Z>{}, X{}, Y{}}; // OK, F<X, Y, Z> deduced F f3 = {Types<X, Y, Z>{}, X{}, W{}}; // error: conflicting types deduced; operator Y not considered — *end example*]
[7](#over.match.class.deduct-7)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L1615)
[*Example [3](#over.match.class.deduct-example-3)*: template <class T, class U> struct C { C(T, U); // #1};template<class T, class U> C(T, U) -> C<T, std::type_identity_t<U>>; // #2template<class V> using A = C<V *, V *>;template<std::[integral](concepts.arithmetic#concept:integral "18.4.7Arithmetic concepts[concepts.arithmetic]") W> using B = A<W>;
int i{};double d{};
A a1(&i, &i); // deduces A<int> A a2(i, i); // error: cannot deduce V * from i A a3(&i, &d); // error: #1: cannot deduce (V*, V*) from (int *, double *)// #2: cannot deduce A<V> from C<int *, double *> B b1(&i, &i); // deduces B<int> B b2(&d, &d); // error: cannot deduce B<W> from C<double *, double *>
Possible exposition-only implementation of the above procedure:// The following concept ensures a specialization of A is deduced.template <class> class AA;template <class V> class AA<A<V>> { };template <class T> concept deduces_A = requires { sizeof(AA<T>); };
// f1 is formed from the constructor #1 of C, generating the following function templatetemplate<class T, class U>auto f1(T, U) -> C<T, U>;
// Deducing arguments for C<T, U> from C<V *, V*> deduces T as V * and U as V *;// f1' is obtained by transforming f1 as described by the above procedure.template<class V> requires deduces_A<C<V *, V *>>auto f1_prime(V *, V*) -> C<V *, V *>;
// f2 is formed from the deduction-guide #2 of Ctemplate<class T, class U> auto f2(T, U) -> C<T, std::type_identity_t<U>>;
// Deducing arguments for C<T, std::type_identity_t<U>> from C<V *, V*> deduces T as V *;// f2' is obtained by transforming f2 as described by the above procedure.template<class V, class U>requires deduces_A<C<V *, std::type_identity_t<U>>>auto f2_prime(V *, U) -> C<V *, std::type_identity_t<U>>;
// The following concept ensures a specialization of B is deduced.template <class> class BB;template <class V> class BB<B<V>> { };template <class T> concept deduces_B = requires { sizeof(BB<T>); };
// The guides for B derived from the above f1' and f2' for A are as follows:template<std::[integral](concepts.arithmetic#concept:integral "18.4.7Arithmetic concepts[concepts.arithmetic]") W>requires deduces_A<C<W *, W *>> && deduces_B<C<W *, W *>>auto f1_prime_for_B(W *, W *) -> C<W *, W *>;
template<std::[integral](concepts.arithmetic#concept:integral "18.4.7Arithmetic concepts[concepts.arithmetic]") W, class U>requires deduces_A<C<W *, std::type_identity_t<U>>> && deduces_B<C<W *, std::type_identity_t<U>>>auto f2_prime_for_B(W *, U) -> C<W *, std::type_identity_t<U>>;
— *end example*]