|
183 | 183 | \pnum |
184 | 184 | A \grammarterm{simple-declaration} with an \grammarterm{identifier-list} is called |
185 | 185 | a \defn{structured binding declaration}\iref{dcl.struct.bind}. |
186 | | -The \grammarterm{decl-specifier-seq} shall |
187 | | -contain only the \grammarterm{type-specifier} \tcode{auto}\iref{dcl.spec.auto} |
188 | | -and \grammarterm{cv-qualifier}{s}. |
| 186 | +If the \grammarterm{decl-specifier-seq} contains |
| 187 | +any \grammarterm{decl-specifier} other than |
| 188 | +\tcode{static}, \tcode{thread_local}, \tcode{auto}\iref{dcl.spec.auto}, or |
| 189 | +\grammarterm{cv-qualifier}{s}, |
| 190 | +the program is ill-formed. |
189 | 191 | The \grammarterm{initializer} shall be |
190 | 192 | of the form ``\tcode{=} \grammarterm{assignment-expression}'', |
191 | 193 | of the form ``\tcode{\{} \grammarterm{assignment-expression} \tcode{\}}'', |
|
370 | 372 | The \tcode{thread_local} specifier |
371 | 373 | indicates that the named entity has thread storage duration\iref{basic.stc.thread}. It |
372 | 374 | shall be applied only |
373 | | -to the declaration of a variable of namespace |
374 | | -or block scope or to the declaration of a static data member. |
| 375 | +to the declaration of a variable of namespace or block scope, |
| 376 | +to a structured binding declaration\iref{dcl.struct.bind}, or |
| 377 | +to the declaration of a static data member. |
375 | 378 | When \tcode{thread_local} is applied to a variable of block scope the |
376 | 379 | \grammarterm{storage-class-specifier} \tcode{static} is implied if no other |
377 | 380 | \grammarterm{storage-class-specifier} appears in the |
378 | 381 | \grammarterm{decl-specifier-seq}. |
379 | 382 |
|
380 | 383 | \pnum |
381 | 384 | \indextext{restriction!\idxcode{static}}% |
382 | | -The \tcode{static} specifier shall be applied only to the declaration of a variable or |
383 | | -function or to the declaration of an anonymous union\iref{class.union.anon}. There can be no |
| 385 | +The \tcode{static} specifier shall be applied only |
| 386 | +to the declaration of a variable or function, |
| 387 | +to a structured binding declaration\iref{dcl.struct.bind}, or |
| 388 | +to the declaration of an anonymous union\iref{class.union.anon}. |
| 389 | +There can be no |
384 | 390 | \tcode{static} function declarations within a block, nor any |
385 | 391 | \tcode{static} function parameters. A \tcode{static} specifier used in |
386 | 392 | the declaration of a variable declares the variable to have static storage |
|
6117 | 6123 | of the |
6118 | 6124 | \grammarterm{identifier-list} as names\iref{basic.scope.declarative} |
6119 | 6125 | of \defn{structured binding}{s}. |
6120 | | -Let \cv{} denote the |
6121 | | -\grammarterm{cv-qualifier}{s} in the \grammarterm{decl-specifier-seq}. First, a |
6122 | | -variable with a unique name \tcode{e} is introduced. If the |
| 6126 | +Let \cv{} denote the \grammarterm{cv-qualifier}{s} in |
| 6127 | +the \grammarterm{decl-specifier-seq} and |
| 6128 | +\placeholder{S} consist of the \grammarterm{storage-class-specifier}{s} of |
| 6129 | +the \grammarterm{decl-specifier-seq} (if any). |
| 6130 | +First, a variable with a unique name \tcode{e} is introduced. If the |
6123 | 6131 | \grammarterm{assignment-expression} in the \grammarterm{initializer} |
6124 | | -has array type \tcode{A} and no \grammarterm{ref-qualifier} is present, \tcode{e} |
6125 | | -has type \cv{}~\tcode{A} and each element is copy-initialized or direct-initialized |
| 6132 | +has array type \tcode{A} and no \grammarterm{ref-qualifier} is present, |
| 6133 | +\tcode{e} is defined by |
| 6134 | + |
| 6135 | +\begin{ncbnf} |
| 6136 | +\opt{attribute-specifier-seq} \placeholder{S} \cv{} \terminal{A e ;} |
| 6137 | +\end{ncbnf} |
| 6138 | + |
| 6139 | +and each element is copy-initialized or direct-initialized |
6126 | 6140 | from the corresponding element of the \grammarterm{assignment-expression} as specified |
6127 | 6141 | by the form of the \grammarterm{initializer}. |
6128 | 6142 | Otherwise, \tcode{e} |
|
6189 | 6203 | Ordinary unqualified lookup\iref{basic.lookup.unqual} is not performed. |
6190 | 6204 | \end{note} |
6191 | 6205 | In either case, \tcode{e} is an lvalue if the type of the entity \tcode{e} |
6192 | | -is an lvalue reference and an xvalue otherwise. Given the type $\tcode{T}_i$ |
6193 | | -designated by \tcode{std::tuple_element<i, E>::type}, |
6194 | | -variables are introduced with unique names $\tcode{r}_i$ |
6195 | | -of type ``reference to $\tcode{T}_i$'' |
6196 | | -initialized with the initializer~(\ref{dcl.init.ref}), |
6197 | | -where the reference is an lvalue reference if the initializer is |
6198 | | -an lvalue and an rvalue reference otherwise. |
| 6206 | +is an lvalue reference and an xvalue otherwise. |
| 6207 | +Given the type $\tcode{T}_i$ designated by |
| 6208 | +\tcode{std::tuple_element<i, E>::type} and |
| 6209 | +the type $\tcode{U}_i$ designated by |
| 6210 | +either \tcode{$\tcode{T}_i$\&} or \tcode{$\tcode{T}_i$\&\&}, |
| 6211 | +where $\tcode{U}_i$ is an lvalue reference if |
| 6212 | +the initializer is an lvalue and an rvalue reference otherwise, |
| 6213 | +variables are introduced with unique names $\tcode{r}_i$ as follows: |
| 6214 | + |
| 6215 | +\begin{ncbnf} |
| 6216 | +\placeholder{S} \terminal{U$_i$ r$_i$ =} initializer \terminal{;} |
| 6217 | +\end{ncbnf} |
| 6218 | + |
6199 | 6219 | Each $\tcode{v}_i$ is the name of an lvalue of type $\tcode{T}_i$ |
6200 | 6220 | that refers to the object bound to $\tcode{r}_i$; |
6201 | 6221 | the referenced type is $\tcode{T}_i$. |
|
0 commit comments