Skip to content

Commit 39e7907

Browse files
committed
P0609R3 Attributes for Structured Bindings
1 parent fa7c7e5 commit 39e7907

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

source/declarations.tex

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,27 @@
6767
\keyword{using} identifier \opt{attribute-specifier-seq} \terminal{=} defining-type-id \terminal{;}
6868
\end{bnf}
6969

70+
\begin{bnf}
71+
\nontermdef{attributed-identifier}\br
72+
identifier \opt{attribute-specifier-seq}
73+
\end{bnf}
74+
75+
\begin{bnf}
76+
\nontermdef{attributed-identifier-list}\br
77+
attributed-identifier\br
78+
attributed-identifier-list \terminal{,} attributed-identifier
79+
\end{bnf}
80+
81+
\begin{bnf}
82+
\nontermdef{structured-binding-declaration}\br
83+
\opt{attribute-specifier-seq} decl-specifier-seq \opt{ref-qualifier} \terminal{[} attributed-identifier-list \terminal{]}
84+
\end{bnf}
85+
7086
\begin{bnf}
7187
\nontermdef{simple-declaration}\br
7288
decl-specifier-seq \opt{init-declarator-list} \terminal{;}\br
7389
attribute-specifier-seq decl-specifier-seq init-declarator-list \terminal{;}\br
74-
\opt{attribute-specifier-seq} decl-specifier-seq \opt{ref-qualifier} \terminal{[} identifier-list \terminal{]} initializer \terminal{;}
90+
structured-binding-declaration initializer \terminal{;}
7591
\end{bnf}
7692

7793
\begin{bnf}
@@ -186,7 +202,7 @@
186202
\end{example}
187203

188204
\pnum
189-
A \grammarterm{simple-declaration} with an \grammarterm{identifier-list} is called
205+
A \grammarterm{simple-declaration} with a \grammarterm{structured-binding-declaration} is called
190206
a \defn{structured binding declaration}\iref{dcl.struct.bind}.
191207
Each \grammarterm{decl-specifier} in the \grammarterm{decl-specifier-seq}
192208
shall be
@@ -6897,8 +6913,11 @@
68976913
A structured binding declaration introduces the \grammarterm{identifier}{s}
68986914
$\tcode{v}_0$, $\tcode{v}_1$, $\tcode{v}_2, \dotsc$
68996915
of the
6900-
\grammarterm{identifier-list} as names
6916+
\grammarterm{attributed-identifier-list} as names
69016917
of \defn{structured binding}{s}.
6918+
The optional \grammarterm{attribute-specifier-seq} of
6919+
an \grammarterm{attributed-identifier}
6920+
appertains to the structured binding so introduced.
69026921
Let \cv{} denote the \grammarterm{cv-qualifier}{s} in
69036922
the \grammarterm{decl-specifier-seq} and
69046923
\placeholder{S} consist of the \grammarterm{storage-class-specifier}{s} of
@@ -6937,7 +6956,7 @@
69376956

69386957
\pnum
69396958
If \tcode{E} is an array type with element type \tcode{T}, the number
6940-
of elements in the \grammarterm{identifier-list} shall be equal to the
6959+
of elements in the \grammarterm{attributed-identifier-list} shall be equal to the
69416960
number of elements of \tcode{E}. Each $\tcode{v}_i$ is the name of an
69426961
lvalue that refers to the element $i$ of the array and whose type
69436962
is \tcode{T}; the referenced type is \tcode{T}.
@@ -6960,7 +6979,7 @@
69606979
shall be a well-formed integral constant expression
69616980
and
69626981
the number of elements in
6963-
the \grammarterm{identifier-list} shall be equal to the value of that
6982+
the \grammarterm{attributed-identifier-list} shall be equal to the value of that
69646983
expression.
69656984
Let \tcode{i} be an index prvalue of type \tcode{std::size_t}
69666985
corresponding to $\tcode{v}_i$.
@@ -7002,7 +7021,7 @@
70027021
well-formed when named as \tcode{\exposidnc{e}.\placeholder{name}}
70037022
in the context of the structured binding,
70047023
\tcode{E} shall not have an anonymous union member, and
7005-
the number of elements in the \grammarterm{identifier-list} shall be
7024+
the number of elements in the \grammarterm{attributed-identifier-list} shall be
70067025
equal to the number of non-static data members of \tcode{E}.
70077026
Designating the non-static data members of \tcode{E} as
70087027
$\tcode{m}_0$, $\tcode{m}_1$, $\tcode{m}_2, \dotsc$
@@ -9175,6 +9194,7 @@
91759194
The attribute may be applied to the declaration of a class,
91769195
\grammarterm{typedef-name},
91779196
variable (including a structured binding declaration),
9197+
structured binding,
91789198
non-static data member,
91799199
function,
91809200
enumeration, or

source/preprocessor.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,7 @@
18621862
\defnxname{cpp_sized_deallocation} & \tcode{201309L} \\ \rowsep
18631863
\defnxname{cpp_static_assert} & \tcode{202306L} \\ \rowsep
18641864
\defnxname{cpp_static_call_operator} & \tcode{202207L} \\ \rowsep
1865-
\defnxname{cpp_structured_bindings} & \tcode{201606L} \\ \rowsep
1865+
\defnxname{cpp_structured_bindings} & \tcode{202403L} \\ \rowsep
18661866
\defnxname{cpp_template_template_args} & \tcode{201611L} \\ \rowsep
18671867
\defnxname{cpp_threadsafe_static_init} & \tcode{200806L} \\ \rowsep
18681868
\defnxname{cpp_unicode_characters} & \tcode{200704L} \\ \rowsep

source/statements.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@
509509
\begin{bnf}
510510
\nontermdef{for-range-declaration}\br
511511
\opt{attribute-specifier-seq} decl-specifier-seq declarator\br
512-
\opt{attribute-specifier-seq} decl-specifier-seq \opt{ref-qualifier} \terminal{[} identifier-list \terminal{]}
512+
structured-binding-declaration
513513
\end{bnf}
514514

515515
\begin{bnf}

0 commit comments

Comments
 (0)