From Jason Turner

[basic.start.init]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1o6qg803/{from.md → to.md} +13 -13
tmp/tmp1o6qg803/{from.md → to.md} RENAMED
@@ -8,29 +8,29 @@ initiation. Non-local variables with thread storage duration are
8
  initialized as a consequence of thread execution. Within each of these
9
  phases of initiation, initialization occurs as follows.
10
 
11
  Variables with static storage duration ([[basic.stc.static]]) or thread
12
  storage duration ([[basic.stc.thread]]) shall be zero-initialized (
13
- [[dcl.init]]) before any other initialization takes place.
14
-
15
- *Constant initialization* is performed:
 
 
 
16
 
17
  - if each full-expression (including implicit conversions) that appears
18
  in the initializer of a reference with static or thread storage
19
  duration is a constant expression ([[expr.const]]) and the reference
20
  is bound to an lvalue designating an object with static storage
21
- duration or to a temporary (see  [[class.temporary]]);
22
  - if an object with static or thread storage duration is initialized by
23
- a constructor call, if the constructor is a `constexpr` constructor,
24
- if all constructor arguments are constant expressions (including
25
- conversions), and if, after function invocation substitution (
26
- [[dcl.constexpr]]), every constructor call and full-expression in the
27
- *mem-initializer*s and in the *brace-or-equal-initializer*s for
28
- non-static data members is a constant expression;
29
  - if an object with static or thread storage duration is not initialized
30
- by a constructor call and if every full-expression that appears in its
31
- initializer is a constant expression.
 
32
 
33
  Together, zero-initialization and constant initialization are called
34
  *static initialization*; all other initialization is *dynamic
35
  initialization*. Static initialization shall be performed before any
36
  dynamic initialization takes place. Dynamic initialization of a
@@ -88,11 +88,11 @@ double d1 = fd(); // may be initialized statically or dynamically to 1.0
88
  It is *implementation-defined* whether the dynamic initialization of a
89
  non-local variable with static storage duration is done before the first
90
  statement of `main`. If the initialization is deferred to some point in
91
  time after the first statement of `main`, it shall occur before the
92
  first odr-use ([[basic.def.odr]]) of any function or variable defined
93
- in the same translation unit as the variable to be initialized.[^10]
94
 
95
  ``` cpp
96
  // - File 1 -
97
  #include "a.h"
98
  #include "b.h"
 
8
  initialized as a consequence of thread execution. Within each of these
9
  phases of initiation, initialization occurs as follows.
10
 
11
  Variables with static storage duration ([[basic.stc.static]]) or thread
12
  storage duration ([[basic.stc.thread]]) shall be zero-initialized (
13
+ [[dcl.init]]) before any other initialization takes place. A *constant
14
+ initializer* for an object `o` is an expression that is a constant
15
+ expression, except that it may also invoke `constexpr` constructors for
16
+ `o` and its subobjects even if those objects are of non-literal class
17
+ types such a class may have a non-trivial destructor . *Constant
18
+ initialization* is performed:
19
 
20
  - if each full-expression (including implicit conversions) that appears
21
  in the initializer of a reference with static or thread storage
22
  duration is a constant expression ([[expr.const]]) and the reference
23
  is bound to an lvalue designating an object with static storage
24
+ duration, to a temporary (see  [[class.temporary]]), or to a function;
25
  - if an object with static or thread storage duration is initialized by
26
+ a constructor call, and if the initialization full-expression is a
27
+ constant initializer for the object;
 
 
 
 
28
  - if an object with static or thread storage duration is not initialized
29
+ by a constructor call and if either the object is value-initialized or
30
+ every full-expression that appears in its initializer is a constant
31
+ expression.
32
 
33
  Together, zero-initialization and constant initialization are called
34
  *static initialization*; all other initialization is *dynamic
35
  initialization*. Static initialization shall be performed before any
36
  dynamic initialization takes place. Dynamic initialization of a
 
88
  It is *implementation-defined* whether the dynamic initialization of a
89
  non-local variable with static storage duration is done before the first
90
  statement of `main`. If the initialization is deferred to some point in
91
  time after the first statement of `main`, it shall occur before the
92
  first odr-use ([[basic.def.odr]]) of any function or variable defined
93
+ in the same translation unit as the variable to be initialized.[^11]
94
 
95
  ``` cpp
96
  // - File 1 -
97
  #include "a.h"
98
  #include "b.h"