Skip to content

Add entry and description for the triadic NewArray operator.#182

Draft
Radnyx wants to merge 1 commit into
microsoft:mainfrom
Radnyx:radnyx/triadic-new-array
Draft

Add entry and description for the triadic NewArray operator.#182
Radnyx wants to merge 1 commit into
microsoft:mainfrom
Radnyx:radnyx/triadic-new-array

Conversation

@Radnyx

@Radnyx Radnyx commented Jun 23, 2026

Copy link
Copy Markdown

Example:

export constexpr int* f1()
{
    return new int[3] { ... };
}

Copilot AI review requested due to automatic review settings June 23, 2026 21:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the IFC specification documentation to introduce a triadic NewArray operator entry, intended to describe array new-expression semantics that include an optional initializer (e.g., new int[3]{ ... }).

Changes:

  • Adds NewArray to the TriadicOperator enumeration.
  • Documents TriadicOperator::NewArray, including operand meanings for array allocation/bound/initializer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ltx/exprs.tex
Comment on lines +2719 to +2731
\ifcSortSection{NewArray}{TriadicOperator}
Abstract machine operation corresponding to allocating appropriate storage for an array and initializing its elements
if an initializer is present.

When used as the value for the \field{assoc} field of a \sortref{Triad}{ExprSort} structure, that structure
represents the semantic operation for an array \grammar{new-expression}, where
\begin{itemize}
\item the first operand designates the array object type
\item the second operand designates the array bound
\item the third operand designates the initializer, or is null if no initializer is present
\end{itemize}

A null third operand designates absence of an initializer, as in \code{new T[n]}, and is distinct from an empty initializer list.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't actually think DyadicOperator::NewArray is used?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be soon. I'll update the spec accordingly.

@Radnyx Radnyx marked this pull request as draft June 24, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants