-
Notifications
You must be signed in to change notification settings - Fork 781
P1009R2 Array size deduction in new-expressions #2731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4433,7 +4433,7 @@ | |
|
||
\begin{bnf} | ||
\nontermdef{noptr-new-declarator}\br | ||
\terminal{[} expression \terminal{]} \opt{attribute-specifier-seq}\br | ||
\terminal{[} \opt{expression} \terminal{]} \opt{attribute-specifier-seq}\br | ||
noptr-new-declarator \terminal{[} constant-expression \terminal{]} \opt{attribute-specifier-seq} | ||
\end{bnf} | ||
|
||
|
@@ -4547,9 +4547,6 @@ | |
\grammarterm{noptr-new-declarator} shall be a converted constant | ||
expression\iref{expr.const} of type \tcode{std::size_t} and | ||
shall evaluate to a strictly positive value. | ||
\indextext{\idxcode{new}}% | ||
The \grammarterm{expression} in a \grammarterm{noptr-new-declarator} is | ||
implicitly converted to \tcode{std::size_t}. | ||
\begin{example} | ||
Given the definition \tcode{int n = 42}, | ||
\tcode{new float[n][5]} is well-formed (because \tcode{n} is the | ||
|
@@ -4559,9 +4556,20 @@ | |
\end{example} | ||
|
||
\pnum | ||
If the \grammarterm{type-id} or \grammarterm{new-type-id} | ||
denotes an array type of unknown bound\iref{dcl.array}, | ||
the \grammarterm{new-initializer} shall not be omitted; | ||
the allocated object is an array with \tcode{n} elements, | ||
where \tcode{n} is determined from the number of initial elements | ||
supplied in | ||
the \grammarterm{new-initializer}~(\ref{dcl.init.aggr}, \ref{dcl.init.string}). | ||
|
||
\pnum | ||
\indextext{\idxcode{new}}% | ||
If the \grammarterm{expression} in a \grammarterm{noptr-new-declarator} | ||
is present, it is implicitly converted to \tcode{std::size_t}. | ||
\indextext{function!allocation}% | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you think this index should precede the new text? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's existing stuff, and I'm not too happy about the indexing here in general. I'd like to leave it as-is for now. |
||
The \grammarterm{expression} in a \grammarterm{noptr-new-declarator} is | ||
erroneous if: | ||
The \grammarterm{expression} is erroneous if: | ||
|
||
\begin{itemize} | ||
\item | ||
|
Uh oh!
There was an error while loading. Please reload this page.