Skip to content

Commit 4f11c52

Browse files
committed
CWG2898 Clarify implicit conversion sequence from cv T to T
Editorial note: The new example is placed after an existing note, even though the wording places it right after the added normative text.
1 parent 280ac3d commit 4f11c52

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

source/overloading.tex

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2126,24 +2126,13 @@
21262126
defined for the purposes of \ref{over}; the actual initialization is
21272127
defined in terms of constructors and is not a conversion.
21282128
\end{note}
2129-
Any difference in top-level cv-qualification is
2130-
subsumed by the initialization itself and does not constitute a conversion.
2131-
\begin{example}
2132-
A parameter of type
2133-
\tcode{A}
2134-
can be initialized from an argument of type
2135-
\tcode{const A}.
2136-
The implicit conversion sequence for that case is the identity sequence; it
2137-
contains no ``conversion'' from
2138-
\tcode{const A}
2139-
to
2140-
\tcode{A}.
2141-
\end{example}
21422129

21432130
\pnum
2144-
When the parameter has a class type and the argument expression has the
2145-
same type, the implicit conversion sequence is an identity conversion.
2131+
When the cv-unqualified version of the type of the argument expression
2132+
is the same as the parameter type,
2133+
the implicit conversion sequence is an identity conversion.
21462134
When the parameter has a class type and the argument expression has a
2135+
(possibly cv-qualified)
21472136
derived class type, the implicit conversion sequence is a
21482137
derived-to-base
21492138
\indextext{conversion!derived-to-base}%
@@ -2153,6 +2142,14 @@
21532142
There is no such standard conversion; this derived-to-base conversion exists
21542143
only in the description of implicit conversion sequences.
21552144
\end{note}
2145+
\begin{example}
2146+
An implicit conversion sequence from an argument of type \tcode{const A}
2147+
to a parameter of type \tcode{A} can be formed,
2148+
even if overload resolution for copy-initialization of \tcode{A}
2149+
from the argument would not find a viable function\iref{over.match.ctor,over.match.viable}.
2150+
The implicit conversion sequence for that case is the identity sequence; it
2151+
contains no ``conversion'' from \tcode{const A} to \tcode{A}.
2152+
\end{example}
21562153

21572154
\pnum
21582155
When the parameter is the implicit object parameter of a static member function,

0 commit comments

Comments
 (0)