From Jason Turner

[class.base.init]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmplbzf3lpp/{from.md → to.md} +16 -10
tmp/tmplbzf3lpp/{from.md → to.md} RENAMED
@@ -35,11 +35,11 @@ name as a direct or virtual base class of the class, a
35
  *mem-initializer-id* naming the member or base class and composed of a
36
  single identifier refers to the class member. A *mem-initializer-id* for
37
  the hidden base class can be specified using a qualified
38
  name. — *end note*]
39
 
40
- Unless the *mem-initializer-id* names the constructor’s class, a
41
  non-static data member of the constructor’s class, or a direct or
42
  virtual base of that class, the *mem-initializer* is ill-formed.
43
 
44
  A *mem-initializer-list* can initialize a base class using any
45
  *class-or-decltype* that denotes that base class type.
@@ -177,11 +177,11 @@ renders the program ill-formed.
177
  [*Note 4*: After the call to a constructor for class `X` for an object
178
  with automatic or dynamic storage duration has completed, if the
179
  constructor was not invoked as part of value-initialization and a member
180
  of `X` is neither initialized nor given a value during execution of the
181
  *compound-statement* of the body of the constructor, the member has an
182
- indeterminate value. — *end note*]
183
 
184
  [*Example 6*:
185
 
186
  ``` cpp
187
  struct A {
@@ -194,11 +194,11 @@ struct B {
194
 
195
  struct C {
196
  C() { } // initializes members as follows:
197
  A a; // OK, calls A::A()
198
  const B b; // error: B has no default constructor
199
- int i; // OK, i has indeterminate value
200
  int j = 5; // OK, j has the value 5
201
  };
202
  ```
203
 
204
  — *end example*]
@@ -332,17 +332,23 @@ the constructor parameter `i`, and initializes `X::j` with the value of
332
  `X::i`; this takes place each time an object of class `X` is created.
333
 
334
  — *end example*]
335
 
336
  Member functions (including virtual member functions, [[class.virtual]])
337
- can be called for an object under construction. Similarly, an object
338
- under construction can be the operand of the `typeid` operator
339
- [[expr.typeid]] or of a `dynamic_cast` [[expr.dynamic.cast]]. However,
340
- if these operations are performed in a *ctor-initializer* (or in a
341
- function called directly or indirectly from a *ctor-initializer*) before
342
- all the *mem-initializer*s for base classes have completed, the program
343
- has undefined behavior.
 
 
 
 
 
 
344
 
345
  [*Example 11*:
346
 
347
  ``` cpp
348
  class A {
 
35
  *mem-initializer-id* naming the member or base class and composed of a
36
  single identifier refers to the class member. A *mem-initializer-id* for
37
  the hidden base class can be specified using a qualified
38
  name. — *end note*]
39
 
40
+ Unless the *mem-initializer-id* names the constructor’s class, a direct
41
  non-static data member of the constructor’s class, or a direct or
42
  virtual base of that class, the *mem-initializer* is ill-formed.
43
 
44
  A *mem-initializer-list* can initialize a base class using any
45
  *class-or-decltype* that denotes that base class type.
 
177
  [*Note 4*: After the call to a constructor for class `X` for an object
178
  with automatic or dynamic storage duration has completed, if the
179
  constructor was not invoked as part of value-initialization and a member
180
  of `X` is neither initialized nor given a value during execution of the
181
  *compound-statement* of the body of the constructor, the member has an
182
+ indeterminate or erroneous value [[basic.indet]]. — *end note*]
183
 
184
  [*Example 6*:
185
 
186
  ``` cpp
187
  struct A {
 
194
 
195
  struct C {
196
  C() { } // initializes members as follows:
197
  A a; // OK, calls A::A()
198
  const B b; // error: B has no default constructor
199
+ int i; // OK, i has indeterminate or erroneous value
200
  int j = 5; // OK, j has the value 5
201
  };
202
  ```
203
 
204
  — *end example*]
 
332
  `X::i`; this takes place each time an object of class `X` is created.
333
 
334
  — *end example*]
335
 
336
  Member functions (including virtual member functions, [[class.virtual]])
337
+ can be called for an object under construction or destruction.
338
+ Similarly, an object under construction or destruction can be the
339
+ operand of the `typeid` operator [[expr.typeid]] or of a `dynamic_cast`
340
+ [[expr.dynamic.cast]]. However, if these operations are performed during
341
+ evaluation of
342
+
343
+ - a *ctor-initializer* (or in a function called directly or indirectly
344
+ from a *ctor-initializer*) before all the *mem-initializer*s for base
345
+ classes have completed,
346
+ - a precondition assertion of a constructor, or
347
+ - a postcondition assertion of a destructor [[dcl.contract.func]],
348
+
349
+ the program has undefined behavior.
350
 
351
  [*Example 11*:
352
 
353
  ``` cpp
354
  class A {