tmp/tmp_ki5uuif/{from.md → to.md}
RENAMED
|
@@ -22,11 +22,11 @@ int* p2 = &bobj.y.i; // undefined behavior: refers to member'
|
|
| 22 |
|
| 23 |
A* pa = &bobj; // undefined behavior: upcast to a base class type
|
| 24 |
B bobj; // definition of bobj
|
| 25 |
|
| 26 |
extern X xobj;
|
| 27 |
-
int* p3 = &xobj.i; // OK,
|
| 28 |
X xobj;
|
| 29 |
```
|
| 30 |
|
| 31 |
For another example,
|
| 32 |
|
|
@@ -41,14 +41,14 @@ struct Y {
|
|
| 41 |
};
|
| 42 |
```
|
| 43 |
|
| 44 |
— *end example*]
|
| 45 |
|
| 46 |
-
During the construction of an object, if the value of
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
|
| 51 |
[*Example 2*:
|
| 52 |
|
| 53 |
``` cpp
|
| 54 |
struct C;
|
|
@@ -114,11 +114,13 @@ struct E : C, D, X {
|
|
| 114 |
|
| 115 |
Member functions, including virtual functions [[class.virtual]], can be
|
| 116 |
called during construction or destruction [[class.base.init]]. When a
|
| 117 |
virtual function is called directly or indirectly from a constructor or
|
| 118 |
from a destructor, including during the construction or destruction of
|
| 119 |
-
the class’s non-static data members,
|
|
|
|
|
|
|
| 120 |
applies is the object (call it `x`) under construction or destruction,
|
| 121 |
the function called is the final overrider in the constructor’s or
|
| 122 |
destructor’s class and not one overriding it in a more-derived class. If
|
| 123 |
the virtual function call uses an explicit class member access
|
| 124 |
[[expr.ref]] and the object expression refers to the complete object of
|
|
|
|
| 22 |
|
| 23 |
A* pa = &bobj; // undefined behavior: upcast to a base class type
|
| 24 |
B bobj; // definition of bobj
|
| 25 |
|
| 26 |
extern X xobj;
|
| 27 |
+
int* p3 = &xobj.i; // OK, all constructors of X are trivial
|
| 28 |
X xobj;
|
| 29 |
```
|
| 30 |
|
| 31 |
For another example,
|
| 32 |
|
|
|
|
| 41 |
};
|
| 42 |
```
|
| 43 |
|
| 44 |
— *end example*]
|
| 45 |
|
| 46 |
+
During the construction of an object, if the value of any of its
|
| 47 |
+
subobjects or any element of its object representation is accessed
|
| 48 |
+
through a glvalue that is not obtained, directly or indirectly, from the
|
| 49 |
+
constructor’s `this` pointer, the value thus obtained is unspecified.
|
| 50 |
|
| 51 |
[*Example 2*:
|
| 52 |
|
| 53 |
``` cpp
|
| 54 |
struct C;
|
|
|
|
| 114 |
|
| 115 |
Member functions, including virtual functions [[class.virtual]], can be
|
| 116 |
called during construction or destruction [[class.base.init]]. When a
|
| 117 |
virtual function is called directly or indirectly from a constructor or
|
| 118 |
from a destructor, including during the construction or destruction of
|
| 119 |
+
the class’s non-static data members, or during the evaluation of a
|
| 120 |
+
postcondition assertion of a constructor or a precondition assertion of
|
| 121 |
+
a destructor [[dcl.contract.func]], and the object to which the call
|
| 122 |
applies is the object (call it `x`) under construction or destruction,
|
| 123 |
the function called is the final overrider in the constructor’s or
|
| 124 |
destructor’s class and not one overriding it in a more-derived class. If
|
| 125 |
the virtual function call uses an explicit class member access
|
| 126 |
[[expr.ref]] and the object expression refers to the complete object of
|