tmp/tmp5p7unh51/{from.md → to.md}
RENAMED
|
@@ -20,11 +20,11 @@ If `T` is “pointer to *cv1* `B`” and `v` has type “pointer to *cv2* `D`”
|
|
| 20 |
such that `B` is a base class of `D`, the result is a pointer to the
|
| 21 |
unique `B` subobject of the `D` object pointed to by `v`, or a null
|
| 22 |
pointer value if `v` is a null pointer value. Similarly, if `T` is
|
| 23 |
“reference to *cv1* `B`” and `v` has type *cv2* `D` such that `B` is a
|
| 24 |
base class of `D`, the result is the unique `B` subobject of the `D`
|
| 25 |
-
object referred to by `v`.[^
|
| 26 |
|
| 27 |
In both the pointer and reference cases, the program is ill-formed if
|
| 28 |
`B` is an inaccessible or ambiguous base class of `D`.
|
| 29 |
|
| 30 |
[*Example 1*:
|
|
@@ -42,10 +42,18 @@ void foo(D* dp) {
|
|
| 42 |
Otherwise, `v` shall be a pointer to or a glvalue of a polymorphic type
|
| 43 |
[[class.virtual]].
|
| 44 |
|
| 45 |
If `v` is a null pointer value, the result is a null pointer value.
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
If `T` is “pointer to cv `void`”, then the result is a pointer to the
|
| 48 |
most derived object pointed to by `v`. Otherwise, a runtime check is
|
| 49 |
applied to see if the object pointed or referred to by `v` can be
|
| 50 |
converted to the type pointed or referred to by `T`.
|
| 51 |
|
|
@@ -53,11 +61,11 @@ Let `C` be the class type to which `T` points or refers. The runtime
|
|
| 53 |
check logically executes as follows:
|
| 54 |
|
| 55 |
- If, in the most derived object pointed (referred) to by `v`, `v`
|
| 56 |
points (refers) to a public base class subobject of a `C` object, and
|
| 57 |
if only one object of type `C` is derived from the subobject pointed
|
| 58 |
-
(referred) to by `v` the result points (refers) to that `C` object.
|
| 59 |
- Otherwise, if `v` points (refers) to a public base class subobject of
|
| 60 |
the most derived object, and the type of the most derived object has a
|
| 61 |
base class, of type `C`, that is unambiguous and public, the result
|
| 62 |
points (refers) to the `C` subobject of the most derived object.
|
| 63 |
- Otherwise, the runtime check *fails*.
|
|
|
|
| 20 |
such that `B` is a base class of `D`, the result is a pointer to the
|
| 21 |
unique `B` subobject of the `D` object pointed to by `v`, or a null
|
| 22 |
pointer value if `v` is a null pointer value. Similarly, if `T` is
|
| 23 |
“reference to *cv1* `B`” and `v` has type *cv2* `D` such that `B` is a
|
| 24 |
base class of `D`, the result is the unique `B` subobject of the `D`
|
| 25 |
+
object referred to by `v`.[^13]
|
| 26 |
|
| 27 |
In both the pointer and reference cases, the program is ill-formed if
|
| 28 |
`B` is an inaccessible or ambiguous base class of `D`.
|
| 29 |
|
| 30 |
[*Example 1*:
|
|
|
|
| 42 |
Otherwise, `v` shall be a pointer to or a glvalue of a polymorphic type
|
| 43 |
[[class.virtual]].
|
| 44 |
|
| 45 |
If `v` is a null pointer value, the result is a null pointer value.
|
| 46 |
|
| 47 |
+
If `v` has type “pointer to cv `U`” and `v` does not point to an object
|
| 48 |
+
whose type is similar [[conv.qual]] to `U` and that is within its
|
| 49 |
+
lifetime or within its period of construction or destruction
|
| 50 |
+
[[class.cdtor]], the behavior is undefined. If `v` is a glvalue of type
|
| 51 |
+
`U` and `v` does not refer to an object whose type is similar to `U` and
|
| 52 |
+
that is within its lifetime or within its period of construction or
|
| 53 |
+
destruction, the behavior is undefined.
|
| 54 |
+
|
| 55 |
If `T` is “pointer to cv `void`”, then the result is a pointer to the
|
| 56 |
most derived object pointed to by `v`. Otherwise, a runtime check is
|
| 57 |
applied to see if the object pointed or referred to by `v` can be
|
| 58 |
converted to the type pointed or referred to by `T`.
|
| 59 |
|
|
|
|
| 61 |
check logically executes as follows:
|
| 62 |
|
| 63 |
- If, in the most derived object pointed (referred) to by `v`, `v`
|
| 64 |
points (refers) to a public base class subobject of a `C` object, and
|
| 65 |
if only one object of type `C` is derived from the subobject pointed
|
| 66 |
+
(referred) to by `v`, the result points (refers) to that `C` object.
|
| 67 |
- Otherwise, if `v` points (refers) to a public base class subobject of
|
| 68 |
the most derived object, and the type of the most derived object has a
|
| 69 |
base class, of type `C`, that is unambiguous and public, the result
|
| 70 |
points (refers) to the `C` subobject of the most derived object.
|
| 71 |
- Otherwise, the runtime check *fails*.
|