Skip to content

Commit e9ae510

Browse files
committed
CWG3011 Parenthesized aggregate initialization for new-expressions
1 parent 8ccae3d commit e9ae510

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

source/expressions.tex

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5953,7 +5953,8 @@
59535953
\impldef{maximum size of an allocated object} limit\iref{implimits}; or
59545954

59555955
\item
5956-
the \grammarterm{new-initializer} is a \grammarterm{braced-init-list} and the
5956+
the \grammarterm{new-initializer} is a \grammarterm{braced-init-list}
5957+
or a parenthesized \grammarterm{expression-list} and the
59575958
number of array elements for which initializers are provided (including the
59585959
terminating \tcode{'\textbackslash 0'} in a \grammarterm{string-literal}\iref{lex.string}) exceeds the
59595960
number of elements to initialize.
@@ -5983,17 +5984,24 @@
59835984

59845985
\pnum
59855986
If the allocated type is an array,
5986-
the \grammarterm{new-initializer} is a \grammarterm{braced-init-list}, and
5987+
the \grammarterm{new-initializer} is a \grammarterm{braced-init-list}
5988+
or a parenthesized \grammarterm{expression-list}, and
59875989
the \grammarterm{expression}
59885990
is potentially-evaluated and not a core constant expression,
5989-
the semantic constraints of copy-initializing a hypothetical element of
5990-
the array from an empty initializer list
5991-
are checked\iref{dcl.init.list}.
5991+
the semantic constraints of initializing a hypothetical element of
5992+
the array are checked as follows:
5993+
\begin{itemize}
5994+
\item
5995+
If the \grammarterm{new-initializer} is a \grammarterm{braced-init-list},
5996+
the hypothetical element is copy-initialized
5997+
from an empty initializer list\iref{dcl.init.list}.
5998+
\item
5999+
Otherwise, the hypothetical element is value-initialized\iref{dcl.init.general}.
6000+
\end{itemize}
59926001
\begin{note}
59936002
The array can contain more elements than there are
5994-
elements in the \grammarterm{braced-init-list},
5995-
requiring initialization of the remainder of the array elements from
5996-
an empty initializer list.
6003+
elements in the \grammarterm{new-initializer},
6004+
requiring initialization of the remainder of the array elements as appropriate.
59976005
\end{note}
59986006

59996007
\pnum

0 commit comments

Comments
 (0)