tmp/tmpu83jc7gf/{from.md → to.md}
RENAMED
|
@@ -1,19 +1,25 @@
|
|
| 1 |
### The `constinit` specifier <a id="dcl.constinit">[[dcl.constinit]]</a>
|
| 2 |
|
| 3 |
The `constinit` specifier shall be applied only to a declaration of a
|
| 4 |
-
variable with static or thread storage duration
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
If a variable declared with the `constinit` specifier has dynamic
|
| 10 |
initialization [[basic.start.dynamic]], the program is ill-formed, even
|
| 11 |
if the implementation would perform that initialization as a static
|
| 12 |
initialization [[basic.start.static]].
|
| 13 |
|
| 14 |
-
[*Note
|
| 15 |
initialized during static initialization. — *end note*]
|
| 16 |
|
| 17 |
[*Example 1*:
|
| 18 |
|
| 19 |
``` cpp
|
|
|
|
| 1 |
### The `constinit` specifier <a id="dcl.constinit">[[dcl.constinit]]</a>
|
| 2 |
|
| 3 |
The `constinit` specifier shall be applied only to a declaration of a
|
| 4 |
+
variable with static or thread storage duration or to a structured
|
| 5 |
+
binding declaration [[dcl.struct.bind]].
|
| 6 |
+
|
| 7 |
+
[*Note 1*: A structured binding declaration introduces a uniquely named
|
| 8 |
+
variable, to which the `constinit` specifier applies. — *end note*]
|
| 9 |
+
|
| 10 |
+
If the specifier is applied to any declaration of a variable, it shall
|
| 11 |
+
be applied to the initializing declaration. No diagnostic is required if
|
| 12 |
+
no `constinit` declaration is reachable at the point of the initializing
|
| 13 |
+
declaration.
|
| 14 |
|
| 15 |
If a variable declared with the `constinit` specifier has dynamic
|
| 16 |
initialization [[basic.start.dynamic]], the program is ill-formed, even
|
| 17 |
if the implementation would perform that initialization as a static
|
| 18 |
initialization [[basic.start.static]].
|
| 19 |
|
| 20 |
+
[*Note 2*: The `constinit` specifier ensures that the variable is
|
| 21 |
initialized during static initialization. — *end note*]
|
| 22 |
|
| 23 |
[*Example 1*:
|
| 24 |
|
| 25 |
``` cpp
|