From Jason Turner

[dcl.spec.general]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpukgdpfte/{from.md → to.md} +78 -0
tmp/tmpukgdpfte/{from.md → to.md} RENAMED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ### General <a id="dcl.spec.general">[[dcl.spec.general]]</a>
2
+
3
+ The specifiers that can be used in a declaration are
4
+
5
+ ``` bnf
6
+ decl-specifier:
7
+ storage-class-specifier
8
+ defining-type-specifier
9
+ function-specifier
10
+ friend
11
+ typedef
12
+ constexpr
13
+ consteval
14
+ constinit
15
+ inline
16
+ ```
17
+
18
+ ``` bnf
19
+ decl-specifier-seq:
20
+ decl-specifier attribute-specifier-seqₒₚₜ
21
+ decl-specifier decl-specifier-seq
22
+ ```
23
+
24
+ The optional *attribute-specifier-seq* in a *decl-specifier-seq*
25
+ appertains to the type determined by the preceding *decl-specifier*s
26
+ [[dcl.meaning]]. The *attribute-specifier-seq* affects the type only for
27
+ the declaration it appears in, not other declarations involving the same
28
+ type.
29
+
30
+ Each *decl-specifier* shall appear at most once in a complete
31
+ *decl-specifier-seq*, except that `long` may appear twice. At most one
32
+ of the `constexpr`, `consteval`, and `constinit` keywords shall appear
33
+ in a *decl-specifier-seq*.
34
+
35
+ If a *type-name* is encountered while parsing a *decl-specifier-seq*, it
36
+ is interpreted as part of the *decl-specifier-seq* if and only if there
37
+ is no previous *defining-type-specifier* other than a *cv-qualifier* in
38
+ the *decl-specifier-seq*. The sequence shall be self-consistent as
39
+ described below.
40
+
41
+ [*Example 1*:
42
+
43
+ ``` cpp
44
+ typedef char* Pc;
45
+ static Pc; // error: name missing
46
+ ```
47
+
48
+ Here, the declaration `static` `Pc` is ill-formed because no name was
49
+ specified for the static variable of type `Pc`. To get a variable called
50
+ `Pc`, a *type-specifier* (other than `const` or `volatile`) has to be
51
+ present to indicate that the *typedef-name* `Pc` is the name being
52
+ (re)declared, rather than being part of the *decl-specifier* sequence.
53
+ For another example,
54
+
55
+ ``` cpp
56
+ void f(const Pc); // void f(char* const) (not const char*)
57
+ void g(const int Pc); // void g(const int)
58
+ ```
59
+
60
+ — *end example*]
61
+
62
+ [*Note 1*:
63
+
64
+ Since `signed`, `unsigned`, `long`, and `short` by default imply `int`,
65
+ a *type-name* appearing after one of those specifiers is treated as the
66
+ name being (re)declared.
67
+
68
+ [*Example 2*:
69
+
70
+ ``` cpp
71
+ void h(unsigned Pc); // void h(unsigned int)
72
+ void k(unsigned int Pc); // void k(unsigned int)
73
+ ```
74
+
75
+ — *end example*]
76
+
77
+ — *end note*]
78
+