|
4117 | 4117 | a program that necessitates such a cast is ill-formed.
|
4118 | 4118 |
|
4119 | 4119 | \pnum
|
4120 |
| -An expression $E$ can be explicitly converted to a type \tcode{T} |
| 4120 | +Any expression can be explicitly converted to type \cv{}~\keyword{void}, |
| 4121 | +in which case the operand is a discarded-value expression\iref{expr.prop}. |
| 4122 | +\begin{note} |
| 4123 | +Such a \keyword{static_cast} has no result |
| 4124 | +as it is a prvalue of type \keyword{void}; see~\ref{basic.lval}. |
| 4125 | +\end{note} |
| 4126 | +\begin{note} |
| 4127 | +However, if the value is in a temporary |
| 4128 | +object\iref{class.temporary}, the destructor for that |
| 4129 | +object is |
| 4130 | +not executed until the usual time, and the value of the object is |
| 4131 | +preserved for the purpose of executing the destructor. |
| 4132 | +\end{note} |
| 4133 | + |
| 4134 | +\pnum |
| 4135 | +Otherwise, an expression $E$ can be explicitly converted to a type \tcode{T} |
4121 | 4136 | if there is an implicit conversion sequence\iref{over.best.ics}
|
4122 | 4137 | from $E$ to \tcode{T},
|
4123 | 4138 | if overload resolution for a direct-initialization\iref{dcl.init}
|
|
4145 | 4160 | \end{note}
|
4146 | 4161 |
|
4147 | 4162 | \pnum
|
4148 |
| -Otherwise, the \keyword{static_cast} shall perform one of the conversions |
4149 |
| -listed below. No other conversion shall be performed explicitly using a |
4150 |
| -\keyword{static_cast}. |
4151 |
| - |
4152 |
| -\pnum |
4153 |
| -Any expression can be explicitly converted to type \cv{}~\keyword{void}, |
4154 |
| -in which case the operand is a discarded-value expression\iref{expr.prop}. |
4155 |
| -\begin{note} |
4156 |
| -Such a \keyword{static_cast} has no result |
4157 |
| -as it is a prvalue of type \keyword{void}; see~\ref{basic.lval}. |
4158 |
| -\end{note} |
4159 |
| -\begin{note} |
4160 |
| -However, if the value is in a temporary |
4161 |
| -object\iref{class.temporary}, the destructor for that |
4162 |
| -object is |
4163 |
| -not executed until the usual time, and the value of the object is |
4164 |
| -preserved for the purpose of executing the destructor. |
4165 |
| -\end{note} |
4166 |
| - |
4167 |
| - |
4168 |
| -\pnum |
4169 |
| -The inverse of any standard conversion sequence\iref{conv} not containing an |
| 4163 | +Otherwise, |
| 4164 | +the inverse of a standard conversion sequence\iref{conv} not containing an |
4170 | 4165 | lvalue-to-rvalue\iref{conv.lval},
|
4171 | 4166 | array-to-pointer\iref{conv.array},
|
4172 | 4167 | function-to-pointer\iref{conv.func},
|
|
4310 | 4305 | \end{codeblock}
|
4311 | 4306 | \end{example}
|
4312 | 4307 |
|
| 4308 | +\pnum |
| 4309 | +No other conversion can be performed using \keyword{static_cast}. |
| 4310 | + |
4313 | 4311 | \rSec3[expr.reinterpret.cast]{Reinterpret cast}
|
4314 | 4312 |
|
4315 | 4313 | \pnum
|
|
0 commit comments