A user-defined implicit conversion from type S
to type T
is processed as follows:
D
, from which user-defined conversion operators will be considered. This set consists of S
(if S
is a class or struct), the base classes of S
(if S
is a class), T
(if T
is a class or struct), and the base classes of T
(if T
is a class).U
. This set consists of the user-defined implicit conversion operators declared by the classes or structs in D
that convert from a type encompassing S
to a type encompassed by T
. If U
is empty, the conversion is undefined and an error occurs.SX
, of the operators in U
:
U
convert from S
, then SX
is S
.SX
is the most encompassed type in the combined set of source types of the operators in U
. If no most encompassed type can be found, then the conversion is ambiguous and an error occurs.TX
, of the operators in U
:
U
convert to T
, then TX
is T
.TX
is the most encompassing type in the combined set of target types of the operators in U
. If no most encompassing type can be found, then the conversion is ambiguous and an error occurs.U
contains exactly one user-defined conversion operator that converts from SX
to TX
, then this is the most specific conversion operator. If no such operator exists, or if more than one such operator exists, then the conversion is ambiguous and an error occurs. Otherwise, the user-defined conversion is applied:
S
is not SX
, then a standard implicit conversion from S
to SX
is performed.SX
to TX
.TX
is not T
, then a standard implicit conversion from TX
to T
is performed.