Skip to content

Commit 1f8ab13

Browse files
jensmaurerzygoloid
authored andcommitted
[dcl.init.aggr] Add example for array of unknown bound (#1270)
* Consistently refer to 'array of unknown bound' not 'array of unknown size'; see [dcl.array]. * [dcl.init.aggr] Add example for array of unknown bound as non-static data member. Addresses core issue 1985. Fixes #396.
1 parent ec9f102 commit 1f8ab13

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

source/basic.tex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3539,7 +3539,7 @@
35393539
\indextext{type!incompletely-defined object}%
35403540
A class that has been declared but not defined, an enumeration type in certain
35413541
contexts~(\ref{dcl.enum}), or an array of unknown
3542-
size or of incomplete element type, is an
3542+
bound or of incomplete element type, is an
35433543
\defnx{incompletely-defined object type}{object type!incompletely-defined}.%
35443544
\footnote{The size and layout of an instance of an incompletely-defined
35453545
object type is unknown.}
@@ -3560,8 +3560,8 @@
35603560
point in a translation unit and complete later on; the array types at
35613561
those two points (``array of unknown bound of \tcode{T}'' and ``array of
35623562
\tcode{N} \tcode{T}'') are different types. The type of a pointer to array of
3563-
unknown size, or of a type defined by a \tcode{typedef} declaration to
3564-
be an array of unknown size, cannot be completed. \begin{example}
3563+
unknown bound, or of a type defined by a \tcode{typedef} declaration to
3564+
be an array of unknown bound, cannot be completed. \begin{example}
35653565

35663566
\indextext{type!example of incomplete}%
35673567
\begin{codeblock}

source/declarators.tex

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,7 +2992,7 @@
29922992
expression not enclosed in braces, as described in~\ref{dcl.init}.
29932993

29942994
\pnum
2995-
An array of unknown size initialized with a
2995+
An array of unknown bound initialized with a
29962996
brace-enclosed
29972997
\grammarterm{initializer-list}
29982998
containing
@@ -3002,7 +3002,7 @@
30023002
\tcode{n}
30033003
shall be greater than zero, is defined as having
30043004
\tcode{n}
3005-
elements (\ref{dcl.array}).
3005+
elements~(\ref{dcl.array}).
30063006
\begin{example}
30073007

30083008
\begin{codeblock}
@@ -3020,6 +3020,20 @@
30203020
for an array of unknown bound.\footnote{The syntax provides for empty
30213021
\grammarterm{initializer-list}{s},
30223022
but nonetheless \Cpp does not have zero length arrays.}
3023+
\begin{note}
3024+
A default member initializer does not determine the bound for a member
3025+
array of unknown bound. Since the default member initializer is
3026+
ignored if a suitable \grammarterm{mem-initializer} is present
3027+
(\ref{class.base.init}), the default member initializer is not
3028+
considered to initialize the array of unknown bound.
3029+
\begin{example}
3030+
\begin{codeblock}
3031+
struct S {
3032+
int y[] = { 0 }; // error: non-static data member of incomplete type
3033+
};
3034+
\end{codeblock}
3035+
\end{example}
3036+
\end{note}
30233037

30243038
\pnum
30253039
\begin{note}

0 commit comments

Comments
 (0)