|
91 | 91 | \grammarterm{using-directive}{s} are described in~\ref{namespace.udir}.
|
92 | 92 | \end{note}
|
93 | 93 |
|
| 94 | +\pnum |
| 95 | +\indextext{declaration}% |
| 96 | +\indextext{scope}% |
| 97 | +Certain declarations contain one or more scopes\iref{basic.scope.scope}. |
| 98 | +Unless otherwise stated, utterances in |
| 99 | +\ref{dcl.dcl} about components in, of, or contained by a |
| 100 | +declaration or subcomponent thereof refer only to those components of |
| 101 | +the declaration that are \emph{not} nested within scopes nested within |
| 102 | +the declaration. |
| 103 | + |
94 | 104 | \pnum
|
95 | 105 | A
|
96 | 106 | \grammarterm{simple-declaration} or
|
|
120 | 130 | \end{example}
|
121 | 131 |
|
122 | 132 | \pnum
|
123 |
| -Except where otherwise specified, the meaning of an \grammarterm{attribute-declaration} |
124 |
| -is \impldef{meaning of attribute declaration}. |
125 |
| - |
126 |
| -\pnum |
127 |
| -\indextext{declaration}% |
128 |
| -\indextext{scope}% |
129 |
| -Certain declarations contain one or more scopes\iref{basic.scope.scope}. |
130 |
| -Unless otherwise stated, utterances in |
131 |
| -\ref{dcl.dcl} about components in, of, or contained by a |
132 |
| -declaration or subcomponent thereof refer only to those components of |
133 |
| -the declaration that are \emph{not} nested within scopes nested within |
134 |
| -the declaration. |
| 133 | +If a \grammarterm{declarator-id} is a name, the |
| 134 | +\grammarterm{init-declarator} and (hence) the declaration introduce that name. |
| 135 | +\begin{note} |
| 136 | +Otherwise, the \grammarterm{declarator-id} is |
| 137 | +a \grammarterm{qualified-id} or |
| 138 | +names a destructor or |
| 139 | +its \grammarterm{unqualified-id} is a \grammarterm{template-id} and |
| 140 | +no name is introduced. |
| 141 | +\end{note} |
| 142 | +The \grammarterm{defining-type-specifier}{s}\iref{dcl.type} in |
| 143 | +the \grammarterm{decl-specifier-seq} and |
| 144 | +the recursive \grammarterm{declarator} structure |
| 145 | +describe a type\iref{dcl.meaning}, |
| 146 | +which is then associated with the \grammarterm{declarator-id}. |
135 | 147 |
|
136 | 148 | \pnum
|
137 | 149 | \indextext{identifier}%
|
|
157 | 169 | \end{codeblock}
|
158 | 170 | \end{example}
|
159 | 171 |
|
160 |
| -\pnum |
161 |
| -\indextext{\idxgram{static_assert}}% |
162 |
| -In a \grammarterm{static_assert-declaration}, the |
163 |
| -\grammarterm{constant-expression} shall be |
164 |
| -a contextually converted constant expression |
165 |
| -of type \tcode{bool}\iref{expr.const}. |
166 |
| -If the value of the expression when |
167 |
| -so converted is \tcode{true}, the declaration has no |
168 |
| -effect. Otherwise, the program is ill-formed, and the resulting |
169 |
| -diagnostic message\iref{intro.compliance} shall include the text of |
170 |
| -the \grammarterm{string-literal}, if one is supplied, |
171 |
| -except that characters not in the basic |
172 |
| -source character set\iref{lex.charset} are not required to appear in |
173 |
| -the diagnostic message. |
174 |
| -\begin{example} |
175 |
| -\begin{codeblock} |
176 |
| -static_assert(sizeof(int) == sizeof(void*), "wrong pointer size"); |
177 |
| -\end{codeblock} |
178 |
| -\end{example} |
179 |
| - |
180 |
| -\pnum |
181 |
| -An \grammarterm{empty-declaration} has no effect. |
182 |
| - |
183 | 172 | \pnum
|
184 | 173 | A \grammarterm{simple-declaration} with an \grammarterm{identifier-list} is called
|
185 | 174 | a \defn{structured binding declaration}\iref{dcl.struct.bind}.
|
|
196 | 185 | where the
|
197 | 186 | \grammarterm{assignment-expression} is of array or non-union class type.
|
198 | 187 |
|
199 |
| -\pnum |
200 |
| -If a \grammarterm{declarator-id} is a name, the |
201 |
| -\grammarterm{init-declarator} and (hence) the declaration introduce that name. |
202 |
| -\begin{note} |
203 |
| -Otherwise, the \grammarterm{declarator-id} is |
204 |
| -a \grammarterm{qualified-id} or |
205 |
| -names a destructor or |
206 |
| -its \grammarterm{unqualified-id} is a \grammarterm{template-id} and |
207 |
| -no name is introduced. |
208 |
| -\end{note} |
209 |
| -The \grammarterm{defining-type-specifier}{s}\iref{dcl.type} in |
210 |
| -the \grammarterm{decl-specifier-seq} and |
211 |
| -the recursive \grammarterm{declarator} structure |
212 |
| -describe a type\iref{dcl.meaning}, |
213 |
| -which is then associated with the \grammarterm{declarator-id}. |
214 |
| - |
215 | 188 | \pnum
|
216 | 189 | If the \grammarterm{decl-specifier-seq} contains the \tcode{typedef}
|
217 | 190 | specifier, the declaration is called a \defnx{typedef declaration}{declaration!typedef}
|
|
231 | 204 | \pnum
|
232 | 205 | \indextext{definition!declaration as}%
|
233 | 206 | Syntactic components beyond those found in the general form of
|
234 |
| -declaration are added to a function declaration to make a |
| 207 | +\grammarterm{simple-declaration} are added to a function declaration to make a |
235 | 208 | \grammarterm{function-definition}. An object declaration, however, is also
|
236 | 209 | a definition unless it contains the \tcode{extern} specifier and has no
|
237 | 210 | initializer\iref{basic.def}.
|
|
249 | 222 | \grammarterm{explicit-specialization}\iref{temp.expl.spec}.
|
250 | 223 | \end{note}
|
251 | 224 |
|
| 225 | +\pnum |
| 226 | +\indextext{\idxgram{static_assert}}% |
| 227 | +In a \grammarterm{static_assert-declaration}, the |
| 228 | +\grammarterm{constant-expression} shall be |
| 229 | +a contextually converted constant expression |
| 230 | +of type \tcode{bool}\iref{expr.const}. |
| 231 | +If the value of the expression when |
| 232 | +so converted is \tcode{true}, the declaration has no |
| 233 | +effect. Otherwise, the program is ill-formed, and the resulting |
| 234 | +diagnostic message\iref{intro.compliance} shall include the text of |
| 235 | +the \grammarterm{string-literal}, if one is supplied, |
| 236 | +except that characters not in the basic |
| 237 | +source character set\iref{lex.charset} are not required to appear in |
| 238 | +the diagnostic message. |
| 239 | +\begin{example} |
| 240 | +\begin{codeblock} |
| 241 | +static_assert(sizeof(int) == sizeof(void*), "wrong pointer size"); |
| 242 | +\end{codeblock} |
| 243 | +\end{example} |
| 244 | + |
| 245 | +\pnum |
| 246 | +An \grammarterm{empty-declaration} has no effect. |
| 247 | + |
| 248 | +\pnum |
| 249 | +Except where otherwise specified, the meaning of an \grammarterm{attribute-declaration} |
| 250 | +is \impldef{meaning of attribute declaration}. |
| 251 | + |
252 | 252 | \rSec1[dcl.spec]{Specifiers}%
|
253 | 253 |
|
254 | 254 | \rSec2[dcl.spec.general]{General}%
|
|
0 commit comments