From Jason Turner

[dcl.attr.indet]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpthra8ibw/{from.md → to.md} +43 -0
tmp/tmpthra8ibw/{from.md → to.md} RENAMED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### Indeterminate storage <a id="dcl.attr.indet">[[dcl.attr.indet]]</a>
2
+
3
+ The *attribute-token* `indeterminate` may be applied to the definition
4
+ of a block variable with automatic storage duration or to a
5
+ *parameter-declaration* of a function declaration. No
6
+ *attribute-argument-clause* shall be present. The attribute specifies
7
+ that the storage of an object with automatic storage duration is
8
+ initially indeterminate rather than erroneous [[basic.indet]].
9
+
10
+ If a function parameter is declared with the `indeterminate` attribute,
11
+ it shall be so declared in the first declaration of its function. If a
12
+ function parameter is declared with the `indeterminate` attribute in the
13
+ first declaration of its function in one translation unit and the same
14
+ function is declared without the `indeterminate` attribute on the same
15
+ parameter in its first declaration in another translation unit, the
16
+ program is ill-formed, no diagnostic required.
17
+
18
+ [*Note 1*:
19
+
20
+ Reading from an uninitialized variable that is marked
21
+ `[[indeterminate]]` can cause undefined behavior.
22
+
23
+ ``` cpp
24
+ void f(int);
25
+ void g() {
26
+ int x [[indeterminate]], y;
27
+ f(y); // erroneous behavior[basic.indet]
28
+ f(x); // undefined behavior
29
+ }
30
+
31
+ struct T {
32
+ T() {}
33
+ int x;
34
+ };
35
+ int h(T t [[indeterminate]]) {
36
+ f(t.x); // undefined behavior when called below
37
+ return 0;
38
+ }
39
+ int _ = h(T());
40
+ ```
41
+
42
+ — *end note*]
43
+