From Jason Turner

[dcl.pre]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmppgjr32ad/{from.md → to.md} +201 -0
tmp/tmppgjr32ad/{from.md → to.md} RENAMED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Preamble <a id="dcl.pre">[[dcl.pre]]</a>
2
+
3
+ Declarations generally specify how names are to be interpreted.
4
+ Declarations have the form
5
+
6
+ ``` bnf
7
+ declaration-seq:
8
+ declaration
9
+ declaration-seq declaration
10
+ ```
11
+
12
+ ``` bnf
13
+ declaration:
14
+ block-declaration
15
+ nodeclspec-function-declaration
16
+ function-definition
17
+ template-declaration
18
+ deduction-guide
19
+ explicit-instantiation
20
+ explicit-specialization
21
+ export-declaration
22
+ linkage-specification
23
+ namespace-definition
24
+ empty-declaration
25
+ attribute-declaration
26
+ module-import-declaration
27
+ ```
28
+
29
+ ``` bnf
30
+ block-declaration:
31
+ simple-declaration
32
+ asm-declaration
33
+ namespace-alias-definition
34
+ using-declaration
35
+ using-enum-declaration
36
+ using-directive
37
+ static_assert-declaration
38
+ alias-declaration
39
+ opaque-enum-declaration
40
+ ```
41
+
42
+ ``` bnf
43
+ nodeclspec-function-declaration:
44
+ attribute-specifier-seqₒₚₜ declarator ';'
45
+ ```
46
+
47
+ ``` bnf
48
+ alias-declaration:
49
+ using identifier attribute-specifier-seqₒₚₜ '=' defining-type-id ';'
50
+ ```
51
+
52
+ ``` bnf
53
+ simple-declaration:
54
+ decl-specifier-seq init-declarator-listₒₚₜ ';'
55
+ attribute-specifier-seq decl-specifier-seq init-declarator-list ';'
56
+ attribute-specifier-seqₒₚₜ decl-specifier-seq ref-qualifierₒₚₜ '[' identifier-list ']' initializer ';'
57
+ ```
58
+
59
+ ``` bnf
60
+ static_assert-declaration:
61
+ static_assert '(' constant-expression ')' ';'
62
+ static_assert '(' constant-expression ',' string-literal ')' ';'
63
+ ```
64
+
65
+ ``` bnf
66
+ empty-declaration:
67
+ ';'
68
+ ```
69
+
70
+ ``` bnf
71
+ attribute-declaration:
72
+ attribute-specifier-seq ';'
73
+ ```
74
+
75
+ [*Note 1*: *asm-declaration*s are described in  [[dcl.asm]], and
76
+ *linkage-specification*s are described in  [[dcl.link]];
77
+ *function-definition*s are described in  [[dcl.fct.def]] and
78
+ *template-declaration*s and *deduction-guide*s are described in
79
+ [[temp.deduct.guide]]; *namespace-definition*s are described in 
80
+ [[namespace.def]], *using-declaration*s are described in 
81
+ [[namespace.udecl]] and *using-directive*s are described in 
82
+ [[namespace.udir]]. — *end note*]
83
+
84
+ A *simple-declaration* or *nodeclspec-function-declaration* of the form
85
+
86
+ ``` bnf
87
+ attribute-specifier-seqₒₚₜ decl-specifier-seqₒₚₜ init-declarator-listₒₚₜ ';'
88
+ ```
89
+
90
+ is divided into three parts. Attributes are described in  [[dcl.attr]].
91
+ *decl-specifier*s, the principal components of a *decl-specifier-seq*,
92
+ are described in  [[dcl.spec]]. *declarator*s, the components of an
93
+ *init-declarator-list*, are described in [[dcl.decl]]. The
94
+ *attribute-specifier-seq* appertains to each of the entities declared by
95
+ the *declarator*s of the *init-declarator-list*.
96
+
97
+ [*Note 2*: In the declaration for an entity, attributes appertaining to
98
+ that entity may appear at the start of the declaration and after the
99
+ *declarator-id* for that declaration. — *end note*]
100
+
101
+ [*Example 1*:
102
+
103
+ ``` cpp
104
+ [[noreturn]] void f [[noreturn]] (); // OK
105
+ ```
106
+
107
+ — *end example*]
108
+
109
+ Except where otherwise specified, the meaning of an
110
+ *attribute-declaration* is *implementation-defined*.
111
+
112
+ A declaration occurs in a scope [[basic.scope]]; the scope rules are
113
+ summarized in  [[basic.lookup]]. A declaration that declares a function
114
+ or defines a class, namespace, template, or function also has one or
115
+ more scopes nested within it. These nested scopes, in turn, can have
116
+ declarations nested within them. Unless otherwise stated, utterances in
117
+ [[dcl.dcl]] about components in, of, or contained by a declaration or
118
+ subcomponent thereof refer only to those components of the declaration
119
+ that are *not* nested within scopes nested within the declaration.
120
+
121
+ In a *simple-declaration*, the optional *init-declarator-list* can be
122
+ omitted only when declaring a class [[class]] or enumeration
123
+ [[dcl.enum]], that is, when the *decl-specifier-seq* contains either a
124
+ *class-specifier*, an *elaborated-type-specifier* with a *class-key*
125
+ [[class.name]], or an *enum-specifier*. In these cases and whenever a
126
+ *class-specifier* or *enum-specifier* is present in the
127
+ *decl-specifier-seq*, the identifiers in these specifiers are among the
128
+ names being declared by the declaration (as *class-name*s, *enum-name*s,
129
+ or *enumerator*s, depending on the syntax). In such cases, the
130
+ *decl-specifier-seq* shall introduce one or more names into the program,
131
+ or shall redeclare a name introduced by a previous declaration.
132
+
133
+ [*Example 2*:
134
+
135
+ ``` cpp
136
+ enum { }; // error
137
+ typedef class { }; // error
138
+ ```
139
+
140
+ — *end example*]
141
+
142
+ In a *static_assert-declaration*, the *constant-expression* shall be a
143
+ contextually converted constant expression of type `bool`
144
+ [[expr.const]]. If the value of the expression when so converted is
145
+ `true`, the declaration has no effect. Otherwise, the program is
146
+ ill-formed, and the resulting diagnostic message [[intro.compliance]]
147
+ shall include the text of the *string-literal*, if one is supplied,
148
+ except that characters not in the basic source character set
149
+ [[lex.charset]] are not required to appear in the diagnostic message.
150
+
151
+ [*Example 3*:
152
+
153
+ ``` cpp
154
+ static_assert(sizeof(int) == sizeof(void*), "wrong pointer size");
155
+ ```
156
+
157
+ — *end example*]
158
+
159
+ An *empty-declaration* has no effect.
160
+
161
+ A *simple-declaration* with an *identifier-list* is called a *structured
162
+ binding declaration* [[dcl.struct.bind]]. If the *decl-specifier-seq*
163
+ contains any *decl-specifier* other than `static`, `thread_local`,
164
+ `auto` [[dcl.spec.auto]], or *cv-qualifier*s, the program is ill-formed.
165
+ The *initializer* shall be of the form “`=` *assignment-expression*”, of
166
+ the form “`{` *assignment-expression* `}`”, or of the form “`(`
167
+ *assignment-expression* `)`”, where the *assignment-expression* is of
168
+ array or non-union class type.
169
+
170
+ Each *init-declarator* in the *init-declarator-list* contains exactly
171
+ one *declarator-id*, which is the name declared by that
172
+ *init-declarator* and hence one of the names declared by the
173
+ declaration. The *defining-type-specifier*s [[dcl.type]] in the
174
+ *decl-specifier-seq* and the recursive *declarator* structure of the
175
+ *init-declarator* describe a type [[dcl.meaning]], which is then
176
+ associated with the name being declared by the *init-declarator*.
177
+
178
+ If the *decl-specifier-seq* contains the `typedef` specifier, the
179
+ declaration is called a *typedef declaration* and the name of each
180
+ *init-declarator* is declared to be a *typedef-name*, synonymous with
181
+ its associated type [[dcl.typedef]]. If the *decl-specifier-seq*
182
+ contains no `typedef` specifier, the declaration is called a *function
183
+ declaration* if the type associated with the name is a function type
184
+ [[dcl.fct]] and an *object declaration* otherwise.
185
+
186
+ Syntactic components beyond those found in the general form of
187
+ declaration are added to a function declaration to make a
188
+ *function-definition*. An object declaration, however, is also a
189
+ definition unless it contains the `extern` specifier and has no
190
+ initializer [[basic.def]]. An object definition causes storage of
191
+ appropriate size and alignment to be reserved and any appropriate
192
+ initialization [[dcl.init]] to be done.
193
+
194
+ A *nodeclspec-function-declaration* shall declare a constructor,
195
+ destructor, or conversion function.
196
+
197
+ [*Note 3*: A *nodeclspec-function-declaration* can only be used in a
198
+ *template-declaration* [[temp.pre]], *explicit-instantiation*
199
+ [[temp.explicit]], or *explicit-specialization*
200
+ [[temp.expl.spec]]. — *end note*]
201
+