tmp/tmp7jnuv3or/{from.md → to.md}
RENAMED
|
@@ -79,13 +79,14 @@ initialized and the declarator is followed by an initializer
|
|
| 79 |
cases, the array bound is calculated from the number of initial elements
|
| 80 |
(say, `N`) supplied [[dcl.init.aggr]], and the type of the array is
|
| 81 |
“array of `N` `U`”.
|
| 82 |
|
| 83 |
Furthermore, if there is a reachable declaration of the entity that
|
| 84 |
-
|
| 85 |
-
array bound is taken to be the same as in that earlier
|
| 86 |
-
similarly for the definition of a static data member of
|
|
|
|
| 87 |
|
| 88 |
[*Example 3*:
|
| 89 |
|
| 90 |
``` cpp
|
| 91 |
extern int x[10];
|
|
@@ -98,10 +99,13 @@ int S::y[]; // OK, bound is 10
|
|
| 98 |
|
| 99 |
void f() {
|
| 100 |
extern int x[];
|
| 101 |
int i = sizeof(x); // error: incomplete object type
|
| 102 |
}
|
|
|
|
|
|
|
|
|
|
| 103 |
```
|
| 104 |
|
| 105 |
— *end example*]
|
| 106 |
|
| 107 |
[*Note 3*:
|
|
|
|
| 79 |
cases, the array bound is calculated from the number of initial elements
|
| 80 |
(say, `N`) supplied [[dcl.init.aggr]], and the type of the array is
|
| 81 |
“array of `N` `U`”.
|
| 82 |
|
| 83 |
Furthermore, if there is a reachable declaration of the entity that
|
| 84 |
+
specifies a bound and has the same host scope [[basic.scope.scope]], an
|
| 85 |
+
omitted array bound is taken to be the same as in that earlier
|
| 86 |
+
declaration, and similarly for the definition of a static data member of
|
| 87 |
+
a class.
|
| 88 |
|
| 89 |
[*Example 3*:
|
| 90 |
|
| 91 |
``` cpp
|
| 92 |
extern int x[10];
|
|
|
|
| 99 |
|
| 100 |
void f() {
|
| 101 |
extern int x[];
|
| 102 |
int i = sizeof(x); // error: incomplete object type
|
| 103 |
}
|
| 104 |
+
|
| 105 |
+
namespace A { extern int z[3]; }
|
| 106 |
+
int A::z[] = {}; // OK, defines an array of 3 elements
|
| 107 |
```
|
| 108 |
|
| 109 |
— *end example*]
|
| 110 |
|
| 111 |
[*Note 3*:
|