Skip to content

P1306R5 Expansion Statements #7986

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,9 @@
The locus of a \grammarterm{for-range-declaration}
of a range-based \keyword{for} statement\iref{stmt.ranged}
is immediately after the \grammarterm{for-range-initializer}.
The locus of a \grammarterm{for-range-declaration}
of an expansion statement\iref{stmt.expand}
is immediately after the \grammarterm{expansion-initializer}.

\pnum
The locus of a \grammarterm{template-parameter} is immediately after it.
Expand Down Expand Up @@ -1341,7 +1344,7 @@
Each
\begin{itemize}
\item
selection or iteration statement\iref{stmt.select,stmt.iter},
selection, iteration, or expansion statement\iref{stmt.select,stmt.iter,stmt.expand},
\item
substatement of such a statement,
\item
Expand Down Expand Up @@ -4591,7 +4594,7 @@
\pnum
\indextext{initializer!temporary and declarator}%
\indextext{temporary!order of destruction of}%
There are five contexts in which temporaries are destroyed at a different
There are several contexts in which temporaries are destroyed at a different
point than the end of the full-expression.
The first context is when a default constructor is called to initialize
an element of an array with no corresponding initializer\iref{dcl.init}.
Expand Down Expand Up @@ -4711,14 +4714,25 @@

\pnum
The fourth context is when a temporary object
is created in the \grammarterm{for-range-initializer} of a range-based \keyword{for} statement.
is created in the \grammarterm{for-range-initializer} of
either a range-based \keyword{for} statement
or an enumerating expansion statement\iref{stmt.expand}.
If such a temporary object would otherwise be destroyed
at the end of the \grammarterm{for-range-initializer} full-expression,
the object persists for the lifetime of the reference
initialized by the \grammarterm{for-range-initializer}.

\pnum
The fifth context is when a temporary object
The fifth context is when a temporary object is created
in the \grammarterm{expansion-initializer}
of an iterating or destructuring expansion statement.
If such a temporary object would otherwise be destroyed
at the end of that \grammarterm{expansion-initializer},
the object persists for the lifetime of the reference
initialized by the \grammarterm{expansion-initializer}, if any.

\pnum
The sixth context is when a temporary object
is created in a structured binding declaration\iref{dcl.struct.bind}.
Any temporary objects introduced by
the \grammarterm{initializer}{s} for the variables
Expand Down
3 changes: 2 additions & 1 deletion source/declarations.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7550,7 +7550,8 @@
the program is ill-formed.

\pnum
If \tcode{E} is an array type with element type \tcode{T},
\tcode{E} shall not be an array type of unknown bound.
If \tcode{E} is any other array type with element type \tcode{T},
the structured binding size of \tcode{E} is equal to the
number of elements of \tcode{E}.
Each $\textrm{SB}_i$ is the name of an
Expand Down
1 change: 1 addition & 0 deletions source/preprocessor.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2311,6 +2311,7 @@
\defnxname{cpp_deleted_function} & \tcode{202403L} \\ \rowsep
\defnxname{cpp_designated_initializers} & \tcode{201707L} \\ \rowsep
\defnxname{cpp_enumerator_attributes} & \tcode{201411L} \\ \rowsep
\defnxname{cpp_expansion_statements} & \tcode{202506L} \\ \rowsep
\defnxname{cpp_explicit_this_parameter} & \tcode{202110L} \\ \rowsep
\defnxname{cpp_fold_expressions} & \tcode{201603L} \\ \rowsep
\defnxname{cpp_generic_lambdas} & \tcode{201707L} \\ \rowsep
Expand Down
Loading