[over.best.ics]

# 12 Overloading [[over]](./#over)

## 12.2 Overload resolution [[over.match]](over.match#over.best.ics)

### 12.2.4 Best viable function [[over.match.best]](over.match.best#over.best.ics)

#### 12.2.4.2 Implicit conversion sequences [over.best.ics]

#### [12.2.4.2.1](#general) General [[over.best.ics.general]](over.best.ics.general)

[1](#general-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2095)

An [*implicit conversion sequence*](#def:conversion_sequence,implicit "12.2.4.2.1 General [over.best.ics.general]") is a sequence of conversions used
to convert an argument in a function call to the type of the
corresponding parameter of the function being called[.](#general-1.sentence-1)

The
sequence of conversions is an implicit conversion as defined in[[conv]](conv "7.3 Standard conversions"), which means it is governed by the rules for
initialization of an object or reference by a single
expression ([[dcl.init]](dcl.init "9.5 Initializers"), [[dcl.init.ref]](dcl.init.ref "9.5.4 References"))[.](#general-1.sentence-2)

[2](#general-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2106)

Implicit conversion sequences are concerned only with the type,
cv-qualification, and value category of the argument and how these
are converted to match the corresponding properties of the
parameter[.](#general-2.sentence-1)

[*Note [1](#general-note-1)*:

Other properties, such as the lifetime, storage duration, linkage,
alignment, accessibility of the argument, whether the argument is a bit-field,
and whether a function is [deleted](dcl.fct.def.delete "9.6.3 Deleted definitions [dcl.fct.def.delete]"), are ignored[.](#general-2.sentence-2)

So, although an implicit
conversion sequence can be defined for a given argument-parameter
pair, the conversion from the argument to the parameter might still
be ill-formed in the final analysis[.](#general-2.sentence-3)

â *end note*]

[3](#general-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2121)

A
well-formed implicit conversion
sequence is one of the following forms:

- [(3.1)](#general-3.1)

a [standard conversion sequence](#over.ics.scs "12.2.4.2.2 Standard conversion sequences [over.ics.scs]"),

- [(3.2)](#general-3.2)

a [user-defined conversion sequence](#over.ics.user "12.2.4.2.3 User-defined conversion sequences [over.ics.user]"), or

- [(3.3)](#general-3.3)

an [ellipsis conversion sequence](#over.ics.ellipsis "12.2.4.2.4 Ellipsis conversion sequences [over.ics.ellipsis]")[.](#general-3.sentence-1)

[4](#general-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2134)

However, if the target is

- [(4.1)](#general-4.1)

the first parameter of a constructor or

- [(4.2)](#general-4.2)

the object parameter of a user-defined conversion function

and the constructor or user-defined conversion function is a candidate by

- [(4.3)](#general-4.3)

[[over.match.ctor]](over.match.ctor "12.2.2.4 Initialization by constructor"), when the argument is the temporary in the second
step of a class copy-initialization,

- [(4.4)](#general-4.4)

[[over.match.copy]](over.match.copy "12.2.2.5 Copy-initialization of class by user-defined conversion"), [[over.match.conv]](over.match.conv "12.2.2.6 Initialization by conversion function"), or [[over.match.ref]](over.match.ref "12.2.2.7 Initialization by conversion function for direct reference binding") (in all cases), or

- [(4.5)](#general-4.5)

the second phase of [[over.match.list]](over.match.list "12.2.2.8 Initialization by list-initialization") when the initializer list has exactly one element that
is itself an initializer list, and
the target is the first parameter of a constructor of class X, and
the conversion is to X or reference to cv X,

user-defined conversion sequences are not considered[.](#general-4.sentence-1)

[*Note [2](#general-note-2)*:

These rules prevent more than one user-defined conversion from being
applied during overload resolution, thereby avoiding infinite recursion[.](#general-4.sentence-2)

â *end note*]

[*Example [1](#general-example-1)*: struct Y { Y(int); };struct A { operator int(); };
Y y1 = A(); // error: A​::​operator int() is not a candidatestruct X { X(); };struct B { operator X(); };
B b;
X x{{b}}; // error: B​::​operator X() is not a candidate â *end example*]

[5](#general-5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2170)

For the case where the parameter type is a reference, see [[over.ics.ref]](#over.ics.ref "12.2.4.2.5 Reference binding")[.](#general-5.sentence-1)

[6](#general-6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2173)

When the parameter type is not a reference, the implicit conversion
sequence models a copy-initialization of the parameter from the argument
expression[.](#general-6.sentence-1)

The implicit conversion sequence is the one required to convert the
argument expression to a prvalue of the type of
the parameter[.](#general-6.sentence-2)

[*Note [3](#general-note-3)*:

When the parameter has a class type, this is a conceptual conversion
defined for the purposes of [[over]](over "12 Overloading"); the actual initialization is
defined in terms of constructors and is not a conversion[.](#general-6.sentence-3)

â *end note*]

[7](#general-7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2186)

When the cv-unqualified version of the type of the argument expression
is the same as the parameter type,
the implicit conversion sequence is an identity conversion[.](#general-7.sentence-1)

When the parameter has a class type and the argument expression has a
(possibly cv-qualified)
derived class type, the implicit conversion sequence is a
derived-to-baseconversion from the derived class to the base class[.](#general-7.sentence-2)

A derived-to-base conversion has Conversion rank ([[over.ics.scs]](#over.ics.scs "12.2.4.2.2 Standard conversion sequences"))[.](#general-7.sentence-3)

[*Note [4](#general-note-4)*:

There is no such standard conversion; this derived-to-base conversion exists
only in the description of implicit conversion sequences[.](#general-7.sentence-4)

â *end note*]

[*Example [2](#general-example-2)*:

An implicit conversion sequence from an argument of type const A to a parameter of type A can be formed,
even if overload resolution for copy-initialization of A from the argument would not find a viable function ([[over.match.ctor]](over.match.ctor "12.2.2.4 Initialization by constructor"), [[over.match.viable]](over.match.viable "12.2.3 Viable functions"))[.](#general-7.sentence-5)

The implicit conversion sequence for that case is the identity sequence; it
contains no âconversionâ from const A to A[.](#general-7.sentence-6)

â *end example*]

[8](#general-8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2210)

When the parameter is the implicit object parameter of a static member function,
the implicit conversion sequence is a standard conversion sequence
that is neither better nor worse than any other standard conversion sequence[.](#general-8.sentence-1)

[9](#general-9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2215)

In all contexts, when converting to the implicit object parameter
or when converting to the left operand of an assignment operation
only standard conversion sequences are allowed[.](#general-9.sentence-1)

[*Note [5](#general-note-5)*:

When a conversion to the explicit object parameter occurs,
it can include user-defined conversion sequences[.](#general-9.sentence-2)

â *end note*]

[10](#general-10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2224)

If no conversions are required to match an argument to a
parameter type, the implicit conversion sequence is the standard
conversion sequence consisting of the identity conversion ([[over.ics.scs]](#over.ics.scs "12.2.4.2.2 Standard conversion sequences"))[.](#general-10.sentence-1)

[11](#general-11)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2229)

If no sequence of conversions can be found to convert an argument
to a parameter type, an implicit conversion sequence cannot be formed[.](#general-11.sentence-1)

[12](#general-12)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2233)

If there are multiple well-formed implicit conversion sequences
converting the argument to the parameter type, the implicit
conversion sequence associated with the parameter is defined to be
the unique conversion sequence designated the[*ambiguous conversion sequence*](#def:conversion_sequence,ambiguous "12.2.4.2.1 General [over.best.ics.general]")[.](#general-12.sentence-1)

For the purpose of ranking implicit conversion sequences as described
in [[over.ics.rank]](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences"), the ambiguous conversion sequence is treated
as a user-defined conversion sequence that is indistinguishable from any
other user-defined conversion sequence[.](#general-12.sentence-2)

[*Note [6](#general-note-6)*:

This rule prevents a function from becoming non-viable because of an ambiguous
conversion sequence for one of its parameters[.](#general-12.sentence-3)

[*Example [3](#general-example-3)*: class B;class A { A (B&);};class B { operator A (); };class C { C (B&); };void f(A) { }void f(C) { } B b;
f(b); // error: ambiguous because there is a conversion b â C (via constructor)// and an (ambiguous) conversion b â A (via constructor or conversion function)void f(B) { } f(b); // OK, unambiguous â *end example*]

â *end note*]

If a function that uses the ambiguous conversion sequence is selected
as the best viable function, the call will be ill-formed because the conversion
of one of the arguments in the call is ambiguous[.](#general-12.sentence-4)

[13](#general-13)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2266)

The three forms of implicit conversion sequences mentioned above
are defined in the following subclauses[.](#general-13.sentence-1)

#### [12.2.4.2.2](#over.ics.scs) Standard conversion sequences [[over.ics.scs]](over.ics.scs)

[1](#over.ics.scs-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2272)

Table [19](#tab:over.ics.scs "Table 19: Conversions") summarizes the conversions defined in [[conv]](conv "7.3 Standard conversions") and
partitions them into four disjoint categories: Lvalue Transformation,
Qualification Adjustment, Promotion, and Conversion[.](#over.ics.scs-1.sentence-1)

[*Note [1](#over.ics.scs-note-1)*:

These categories are orthogonal with respect to value category,
cv-qualification, and data representation: the Lvalue Transformations
do not change the cv-qualification or data
representation of the type; the Qualification Adjustments do not
change the value category or data representation of the type; and
the Promotions and Conversions do not change the
value category or cv-qualification of the type[.](#over.ics.scs-1.sentence-2)

â *end note*]

[2](#over.ics.scs-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2287)

[*Note [2](#over.ics.scs-note-2)*:

As described in [[conv]](conv "7.3 Standard conversions"),
a standard conversion sequence either is the Identity conversion
by itself (that is, no conversion) or consists of one to three
conversions from the other
four categories[.](#over.ics.scs-2.sentence-1)

If there are two or more conversions in the sequence, the
conversions are applied in the canonical order:**Lvalue Transformation**,**Promotion** or**Conversion**,**Qualification Adjustment**[.](#over.ics.scs-2.sentence-2)

â *end note*]

[3](#over.ics.scs-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2303)

Each conversion in Table [19](#tab:over.ics.scs "Table 19: Conversions") also has an associated rank (Exact
Match, Promotion, or Conversion)[.](#over.ics.scs-3.sentence-1)

These are used
to [rank standard conversion sequences](over.ics.rank "12.2.4.3 Ranking implicit conversion sequences [over.ics.rank]")[.](#over.ics.scs-3.sentence-2)

The rank of a conversion sequence is determined by considering the
rank of each conversion in the sequence and the rank of any [reference
binding](#over.ics.ref "12.2.4.2.5 Reference binding [over.ics.ref]")[.](#over.ics.scs-3.sentence-3)

If any of those has Conversion rank, the
sequence has Conversion rank; otherwise, if any of those has Promotion rank,
the sequence has Promotion rank; otherwise, the sequence has Exact
Match rank[.](#over.ics.scs-3.sentence-4)

Table [19](#tab:over.ics.scs) — Conversions [[tab:over.ics.scs]](./tab:over.ics.scs)  

| [ð](#tab:over.ics.scs-row-1)<br>**Conversion** | **Category** | **Rank** | **Subclause** |
| --- | --- | --- | --- |
| [ð](#tab:over.ics.scs-row-2)<br>No conversions required | Identity |  |  |
| [ð](#tab:over.ics.scs-row-3)<br> Lvalue-to-rvalue conversion |  |  | [[conv.lval]](conv.lval "7.3.2 Lvalue-to-rvalue conversion") |
| [ð](#tab:over.ics.scs-row-4)<br> Array-to-pointer conversion | Lvalue Transformation |  | [[conv.array]](conv.array "7.3.3 Array-to-pointer conversion") |
| [ð](#tab:over.ics.scs-row-5)<br> Function-to-pointer conversion |  | Exact Match | [[conv.func]](conv.func "7.3.4 Function-to-pointer conversion") |
| [ð](#tab:over.ics.scs-row-6)<br> Qualification conversions |  |  | [[conv.qual]](conv.qual "7.3.6 Qualification conversions") |
| [ð](#tab:over.ics.scs-row-7)<br> Function pointer conversion | Qualification Adjustment |  | [[conv.fctptr]](conv.fctptr "7.3.14 Function pointer conversions") |
| [ð](#tab:over.ics.scs-row-8)<br>Integral promotions |  |  | [[conv.prom]](conv.prom "7.3.7 Integral promotions") |
| [ð](#tab:over.ics.scs-row-9)<br> Floating-point promotion | Promotion | Promotion | [[conv.fpprom]](conv.fpprom "7.3.8 Floating-point promotion") |
| [ð](#tab:over.ics.scs-row-10)<br>Integral conversions |  |  | [[conv.integral]](conv.integral "7.3.9 Integral conversions") |
| [ð](#tab:over.ics.scs-row-11)<br> Floating-point conversions |  |  | [[conv.double]](conv.double "7.3.10 Floating-point conversions") |
| [ð](#tab:over.ics.scs-row-12)<br> Floating-integral conversions |  |  | [[conv.fpint]](conv.fpint "7.3.11 Floating-integral conversions") |
| [ð](#tab:over.ics.scs-row-13)<br> Pointer conversions | Conversion | Conversion | [[conv.ptr]](conv.ptr "7.3.12 Pointer conversions") |
| [ð](#tab:over.ics.scs-row-14)<br> Pointer-to-member conversions |  |  | [[conv.mem]](conv.mem "7.3.13 Pointer-to-member conversions") |
| [ð](#tab:over.ics.scs-row-15)<br> Boolean conversions |  |  | [[conv.bool]](conv.bool "7.3.15 Boolean conversions") |

#### [12.2.4.2.3](#over.ics.user) User-defined conversion sequences [[over.ics.user]](over.ics.user)

[1](#over.ics.user-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2339)

A [*user-defined conversion sequence*](#def:conversion_sequence,user-defined "12.2.4.2.3 User-defined conversion sequences [over.ics.user]") consists of an initial
standard conversion sequence followed by a user-defined
conversion ([[class.conv]](class.conv "11.4.8 Conversions")) followed by a second standard
conversion sequence[.](#over.ics.user-1.sentence-1)

If the user-defined conversion is specified
by a constructor ([[class.conv.ctor]](class.conv.ctor "11.4.8.2 Conversion by constructor")), the initial standard
conversion sequence converts the source type to the type of the
first parameter of that constructor[.](#over.ics.user-1.sentence-2)

If the user-defined
conversion is specified by a [conversion function](class.conv.fct "11.4.8.3 Conversion functions [class.conv.fct]"), the
initial standard conversion sequence
converts the source type to the type of the
object parameter of that conversion function[.](#over.ics.user-1.sentence-3)

[2](#over.ics.user-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2354)

The second standard conversion sequence converts the result of
the user-defined conversion to the target type for the sequence;
any reference binding is included in the second standard
conversion sequence[.](#over.ics.user-2.sentence-1)

Since an implicit conversion sequence is an initialization, the
special rules for initialization by user-defined conversion apply
when selecting the best user-defined conversion for a
user-defined conversion sequence (see [[over.match.best]](over.match.best "12.2.4 Best viable function") and [over.best.ics])[.](#over.ics.user-2.sentence-2)

[3](#over.ics.user-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2364)

If the user-defined conversion is specified by a
specialization of a conversion function template,
the second standard conversion sequence shall have Exact Match rank[.](#over.ics.user-3.sentence-1)

[4](#over.ics.user-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2369)

A conversion of an expression of class type
to the same class type is given Exact Match rank, and
a conversion of an expression of class type
to a base class of that type is given Conversion rank,
in spite of the
fact that a constructor (i.e., a user-defined conversion
function) is called for those cases[.](#over.ics.user-4.sentence-1)

#### [12.2.4.2.4](#over.ics.ellipsis) Ellipsis conversion sequences [[over.ics.ellipsis]](over.ics.ellipsis)

[1](#over.ics.ellipsis-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2380)

An ellipsis conversion sequence occurs when an argument in a
function call is matched with the ellipsis parameter
specification of the function called (see [[expr.call]](expr.call "7.6.1.3 Function call"))[.](#over.ics.ellipsis-1.sentence-1)

#### [12.2.4.2.5](#over.ics.ref) Reference binding [[over.ics.ref]](over.ics.ref)

[1](#over.ics.ref-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2388)

When a parameter of type âreference to cv Tâ
binds directly ([[dcl.init.ref]](dcl.init.ref "9.5.4 References")) to an argument expression:

- [(1.1)](#over.ics.ref-1.1)

  If the argument expression has a type that
is a derived class of the parameter type,
the implicit conversion sequence is a derived-to-base
conversion ([over.best.ics])[.](#over.ics.ref-1.1.sentence-1)

- [(1.2)](#over.ics.ref-1.2)

  Otherwise,
if the type of the argument is possibly cv-qualified T, or
if T is an array type of unknown bound with element type U and
the argument has an array type of known bound whose
element type is possibly cv-qualified U,
the implicit conversion sequence is the identity conversion[.](#over.ics.ref-1.2.sentence-1)

- [(1.3)](#over.ics.ref-1.3)

  Otherwise,
if T is a function type,
the implicit conversion sequence is a function pointer conversion[.](#over.ics.ref-1.3.sentence-1)

- [(1.4)](#over.ics.ref-1.4)

  Otherwise, the implicit conversion sequence is a qualification conversion[.](#over.ics.ref-1.4.sentence-1)

[*Example [1](#over.ics.ref-example-1)*: struct A {};struct B : public A {} b;int f(A&);int f(B&);int i = f(b); // calls f(B&), an exact match, rather than f(A&), a conversionvoid g() noexcept;int h(void (&)() noexcept); // #1int h(void (&)()); // #2int j = h(g); // calls #1, an exact match, rather than #2, a function pointer conversion â *end example*]

If the parameter binds directly to the result of
applying a conversion function to the argument expression, the implicit
conversion sequence is a user-defined conversion sequence ([[over.ics.user]](#over.ics.user "12.2.4.2.3 User-defined conversion sequences"))
whose second standard conversion sequence is
determined by the above rules[.](#over.ics.ref-1.sentence-2)

[2](#over.ics.ref-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2435)

When a parameter of reference type is not bound directly to an argument
expression, the conversion sequence is the one required to convert the argument
expression to the referenced type according to [over.best.ics][.](#over.ics.ref-2.sentence-1)

Conceptually, this conversion sequence corresponds to copy-initializing a
temporary of the referenced type with the argument expression[.](#over.ics.ref-2.sentence-2)

Any difference
in top-level cv-qualification is subsumed by the initialization itself and
does not constitute a conversion[.](#over.ics.ref-2.sentence-3)

[3](#over.ics.ref-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2445)

Except for an implicit object parameter, for which see [[over.match.funcs]](over.match.funcs "12.2.2 Candidate functions and argument lists"),
an implicit conversion sequence cannot be formed if it requires
binding an lvalue reference
other than a reference to a non-volatile const type
to an rvalue
or binding an rvalue reference to an lvalue of object type[.](#over.ics.ref-3.sentence-1)

[*Note [1](#over.ics.ref-note-1)*:

This means, for example, that a candidate function cannot be a viable
function if it has a non-const lvalue reference parameter (other than
the implicit object parameter) and the corresponding argument
would require a temporary to be created to initialize the lvalue
reference (see [[dcl.init.ref]](dcl.init.ref "9.5.4 References"))[.](#over.ics.ref-3.sentence-2)

â *end note*]

[4](#over.ics.ref-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2460)

Other restrictions on binding a reference to a particular argument
that are not based on the types of the reference and the argument
do not affect the formation of an implicit conversion
sequence, however[.](#over.ics.ref-4.sentence-1)

[*Example [2](#over.ics.ref-example-2)*:

A function with an âlvalue reference to intâ parameter can
be a viable candidate even if the corresponding argument is anint bit-field[.](#over.ics.ref-4.sentence-2)

The formation of implicit conversion sequences
treats theint bit-field as anint lvalue and finds an exact
match with the parameter[.](#over.ics.ref-4.sentence-3)

If the function is selected by overload
resolution, the call will nonetheless be ill-formed because of
the prohibition on binding a non-const lvalue reference to a bit-field ([[dcl.init.ref]](dcl.init.ref "9.5.4 References"))[.](#over.ics.ref-4.sentence-4)

â *end example*]

#### [12.2.4.2.6](#over.ics.list) List-initialization sequence [[over.ics.list]](over.ics.list)

[1](#over.ics.list-1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2484)

When an argument is an initializer list ([[dcl.init.list]](dcl.init.list "9.5.5 List-initialization")), it is not an expression and special rules apply for converting it to a parameter type[.](#over.ics.list-1.sentence-1)

[2](#over.ics.list-2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2488)

If the initializer list is a [*designated-initializer-list*](dcl.init.general#nt:designated-initializer-list "9.5.1 General [dcl.init.general]") and the parameter is not a reference,
a conversion is only possible if
the parameter has an aggregate type
that can be initialized from the initializer list
according to the rules for aggregate initialization ([[dcl.init.aggr]](dcl.init.aggr "9.5.2 Aggregates")),
in which case the implicit conversion sequence is
a user-defined conversion sequence
whose second standard conversion sequence
is an identity conversion[.](#over.ics.list-2.sentence-1)

[*Note [1](#over.ics.list-note-1)*:

Aggregate initialization does not require that
the members are declared in designation order[.](#over.ics.list-2.sentence-2)

If, after overload resolution, the order does not match
for the selected overload,
the initialization of the parameter will be ill-formed ([[dcl.init.list]](dcl.init.list "9.5.5 List-initialization"))[.](#over.ics.list-2.sentence-3)

[*Example [1](#over.ics.list-example-1)*: struct A { int x, y; };struct B { int y, x; };void f(A a, int); // #1void f(B b, ...); // #2void g(A a); // #3void g(B b); // #4void h() { f({.x = 1, .y = 2}, 0); // OK; calls #1 f({.y = 2, .x = 1}, 0); // error: selects #1, initialization of a fails// due to non-matching member order ([[dcl.init.list]](dcl.init.list "9.5.5 List-initialization")) g({.x = 1, .y = 2}); // error: ambiguous between #3 and #4} â *end example*]

â *end note*]

[3](#over.ics.list-3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2523)

Otherwise,
if the parameter type is an aggregate class X and the initializer list has a
single element of type cv U, where U is X or a class derived from X, the implicit conversion sequence is the one
required to convert the element to the parameter type[.](#over.ics.list-3.sentence-1)

[4](#over.ics.list-4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2530)

Otherwise, if the parameter type is a character array[106](#footnote-106 "Since there are no parameters of array type, this will only occur as the referenced type of a reference parameter.") and the initializer list has a single element that is an appropriately-typed[*string-literal*](lex.string#nt:string-literal "5.13.5 String literals [lex.string]") ([[dcl.init.string]](dcl.init.string "9.5.3 Character arrays")), the implicit conversion
sequence is the identity conversion[.](#over.ics.list-4.sentence-1)

[5](#over.ics.list-5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2540)

Otherwise, if the parameter type is std​::​initializer_list<X> and all the elements
of the initializer list can be implicitly converted to X, the implicit
conversion sequence is the worst conversion necessary to convert an element of
the list to X, or if the initializer list has no elements, the identity
conversion[.](#over.ics.list-5.sentence-1)

This conversion can be a user-defined conversion even in
the context of a call to an initializer-list constructor[.](#over.ics.list-5.sentence-2)

[*Example [2](#over.ics.list-example-2)*: void f(std::initializer_list<int>);
f( {} ); // OK, f(initializer_list<int>) identity conversion f( {1,2,3} ); // OK, f(initializer_list<int>) identity conversion f( {'a','b'} ); // OK, f(initializer_list<int>) integral promotion f( {1.0} ); // error: narrowingstruct A { A(std::initializer_list<double>); // #1 A(std::initializer_list<std::complex<double>>); // #2 A(std::initializer_list<std::string>); // #3};
A a{ 1.0,2.0 }; // OK, uses #1void g(A);
g({ "foo", "bar" }); // OK, uses #3typedef int IA[3];void h(const IA&);
h({ 1, 2, 3 }); // OK, identity conversion â *end example*]

[6](#over.ics.list-6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2572)

Otherwise, if the parameter type is âarray of N Xâ
or âarray of unknown bound of Xâ,
if there exists an implicit conversion sequence
from each element of the initializer list
(and from {} in the former case
if N exceeds the number of elements in the initializer list)
to X, the implicit conversion sequence is
the worst such implicit conversion sequence[.](#over.ics.list-6.sentence-1)

[7](#over.ics.list-7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2582)

Otherwise, if the parameter is a non-aggregate class X and overload
resolution per [[over.match.list]](over.match.list "12.2.2.8 Initialization by list-initialization") chooses a single best constructor C ofX to perform the initialization of an object of type X from the
argument initializer list:

- [(7.1)](#over.ics.list-7.1)

  If C is not an initializer-list constructor
and the initializer list has a single element of type cv U,
where U is X or a class derived from X,
the implicit conversion sequence has Exact Match rank if U is X,
or Conversion rank if U is derived from X[.](#over.ics.list-7.1.sentence-1)

- [(7.2)](#over.ics.list-7.2)

  Otherwise, the implicit conversion sequence is a user-defined
conversion sequence whose second standard conversion sequence is an
identity conversion[.](#over.ics.list-7.2.sentence-1)

If multiple constructors are viable but none is better than
the others, the implicit conversion sequence is the ambiguous conversion
sequence[.](#over.ics.list-7.sentence-2)

User-defined conversions are allowed for conversion of the initializer
list elements to the constructor parameter types except as noted
in [over.best.ics][.](#over.ics.list-7.sentence-3)

[*Example [3](#over.ics.list-example-3)*: struct A { A(std::initializer_list<int>);};void f(A);
f( {'a', 'b'} ); // OK, f(A(std​::​initializer_list<int>)) user-defined conversionstruct B { B(int, double);};void g(B);
g( {'a', 'b'} ); // OK, g(B(int, double)) user-defined conversion g( {1.0, 1.0} ); // error: narrowingvoid f(B);
f( {'a', 'b'} ); // error: ambiguous f(A) or f(B)struct C { C(std::string);};void h(C);
h({"foo"}); // OK, h(C(std​::​string("foo")))struct D { D(A, C);};void i(D);
i({ {1,2}, {"bar"} }); // OK, i(D(A(std​::​initializer_list<int>{1,2}), C(std​::​string("bar")))) â *end example*]

[8](#over.ics.list-8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2636)

Otherwise, if the parameter has an aggregate type which can be initialized from
the initializer list according to the rules for aggregate
initialization ([[dcl.init.aggr]](dcl.init.aggr "9.5.2 Aggregates")), the implicit conversion sequence is a
user-defined conversion sequence whose second standard conversion
sequence is an identity conversion[.](#over.ics.list-8.sentence-1)

[*Example [4](#over.ics.list-example-4)*: struct A {int m1; double m2;};

void f(A);
f( {'a', 'b'} ); // OK, f(A(int,double)) user-defined conversion f( {1.0} ); // error: narrowing â *end example*]

[9](#over.ics.list-9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2655)

Otherwise, if the parameter is a reference, see [[over.ics.ref]](#over.ics.ref "12.2.4.2.5 Reference binding")[.](#over.ics.list-9.sentence-1)

[*Note [2](#over.ics.list-note-2)*:

The rules in this subclause will apply for initializing the underlying temporary
for the reference[.](#over.ics.list-9.sentence-2)

â *end note*]

[*Example [5](#over.ics.list-example-5)*: struct A {int m1; double m2;};

void f(const A&);
f( {'a', 'b'} ); // OK, f(A(int,double)) user-defined conversion f( {1.0} ); // error: narrowingvoid g(const double &);
g({1}); // same conversion as int to double â *end example*]

[10](#over.ics.list-10)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2677)

Otherwise, if the parameter type is not a class:

- [(10.1)](#over.ics.list-10.1)

if the initializer list has one element that is not itself an initializer list,
the implicit conversion sequence is the one required to convert the element to
the parameter type;
  [*Example [6](#over.ics.list-example-6)*: void f(int);
f( {'a'} ); // OK, same conversion as char to int f( {1.0} ); // error: narrowing â *end example*]

- [(10.2)](#over.ics.list-10.2)

if the initializer list has no elements, the implicit conversion sequence
is the identity conversion[.](#over.ics.list-10.sentence-1)
  [*Example [7](#over.ics.list-example-7)*: void f(int);
f( { } ); // OK, identity conversion â *end example*]

[11](#over.ics.list-11)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L2701)

In all cases other than those enumerated above, no conversion is possible[.](#over.ics.list-11.sentence-1)

[106)](#footnote-106)[106)](#footnoteref-106)

Since there are no parameters of array type,
this will only occur as the referenced type of a reference parameter[.](#footnote-106.sentence-1)
