From Jason Turner

[dcl.type.elab]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpq5zlw8i0/{from.md → to.md} +28 -28
tmp/tmpq5zlw8i0/{from.md → to.md} RENAMED
@@ -12,77 +12,77 @@ The component names of an *elaborated-type-specifier* are its
12
  *identifier* (if any) and those of its *nested-name-specifier* and
13
  *simple-template-id* (if any).
14
 
15
  If an *elaborated-type-specifier* is the sole constituent of a
16
  declaration, the declaration is ill-formed unless it is an explicit
17
- specialization [[temp.expl.spec]], an explicit instantiation
18
- [[temp.explicit]] or it has one of the following forms:
 
19
 
20
  ``` bnf
21
  class-key attribute-specifier-seqₒₚₜ identifier ';'
22
  class-key attribute-specifier-seqₒₚₜ simple-template-id ';'
23
  ```
24
 
25
  In the first case, the *elaborated-type-specifier* declares the
26
  *identifier* as a *class-name*. The second case shall appear only in an
27
  *explicit-specialization* [[temp.expl.spec]] or in a
28
- *template-declaration* (where it declares a partial specialization
29
- [[temp.decls]]). The *attribute-specifier-seq*, if any, appertains to
30
- the class or template being declared.
31
 
32
  Otherwise, an *elaborated-type-specifier* E shall not have an
33
  *attribute-specifier-seq*. If E contains an *identifier* but no
34
  *nested-name-specifier* and (unqualified) lookup for the *identifier*
35
  finds nothing, E shall not be introduced by the `enum` keyword and
36
  declares the *identifier* as a *class-name*. The target scope of E is
37
  the nearest enclosing namespace or block scope.
38
 
39
- If an *elaborated-type-specifier* appears with the `friend` specifier as
40
- an entire *member-declaration*, the *member-declaration* shall have one
41
- of the following forms:
42
 
43
  ``` bnf
44
- friend class-key nested-name-specifierₒₚₜ identifier ';'
45
- friend class-key simple-template-id ';'
46
- friend class-key nested-name-specifier templateₒₚₜ simple-template-id ';'
47
  ```
48
 
49
  Any unqualified lookup for the *identifier* (in the first case) does not
50
- consider scopes that contain the target scope; no name is bound.
 
51
 
52
  [*Note 1*: A *using-directive* in the target scope is ignored if it
53
- refers to a namespace not contained by that scope. [[basic.lookup.elab]]
54
- describes how name lookup proceeds in an
55
- *elaborated-type-specifier*. — *end note*]
56
 
57
- [*Note 2*: An *elaborated-type-specifier* can be used to refer to a
58
- previously declared *class-name* or *enum-name* even if the name has
59
- been hidden by a non-type declaration. *end note*]
 
60
 
61
- If the *identifier* or *simple-template-id* resolves to a *class-name*
62
- or *enum-name*, the *elaborated-type-specifier* introduces it into the
63
- declaration the same way a *simple-type-specifier* introduces its
64
- *type-name* [[dcl.type.simple]]. If the *identifier* or
65
- *simple-template-id* resolves to a *typedef-name*
66
- [[dcl.typedef]], [[temp.names]], the *elaborated-type-specifier* is
67
- ill-formed.
68
 
69
  [*Note 3*:
70
 
71
  This implies that, within a class template with a template
72
  *type-parameter* `T`, the declaration
73
 
74
  ``` cpp
75
  friend class T;
76
  ```
77
 
78
- is ill-formed. However, the similar declaration `friend T;` is allowed
79
- [[class.friend]].
80
 
81
  — *end note*]
82
 
83
- The *class-key* or `enum` keyword present in the
84
  *elaborated-type-specifier* shall agree in kind with the declaration to
85
  which the name in the *elaborated-type-specifier* refers. This rule also
86
  applies to the form of *elaborated-type-specifier* that declares a
87
  *class-name* or friend class since it can be construed as referring to
88
  the definition of the class. Thus, in any *elaborated-type-specifier*,
 
12
  *identifier* (if any) and those of its *nested-name-specifier* and
13
  *simple-template-id* (if any).
14
 
15
  If an *elaborated-type-specifier* is the sole constituent of a
16
  declaration, the declaration is ill-formed unless it is an explicit
17
+ specialization [[temp.expl.spec]], a partial specialization
18
+ [[temp.spec.partial]], an explicit instantiation [[temp.explicit]], or
19
+ it has one of the following forms:
20
 
21
  ``` bnf
22
  class-key attribute-specifier-seqₒₚₜ identifier ';'
23
  class-key attribute-specifier-seqₒₚₜ simple-template-id ';'
24
  ```
25
 
26
  In the first case, the *elaborated-type-specifier* declares the
27
  *identifier* as a *class-name*. The second case shall appear only in an
28
  *explicit-specialization* [[temp.expl.spec]] or in a
29
+ *template-declaration* (where it declares a partial specialization). The
30
+ *attribute-specifier-seq*, if any, appertains to the class or template
31
+ being declared.
32
 
33
  Otherwise, an *elaborated-type-specifier* E shall not have an
34
  *attribute-specifier-seq*. If E contains an *identifier* but no
35
  *nested-name-specifier* and (unqualified) lookup for the *identifier*
36
  finds nothing, E shall not be introduced by the `enum` keyword and
37
  declares the *identifier* as a *class-name*. The target scope of E is
38
  the nearest enclosing namespace or block scope.
39
 
40
+ A *friend-type-specifier* that is an *elaborated-type-specifier* shall
41
+ have one of the following forms:
 
42
 
43
  ``` bnf
44
+ class-key nested-name-specifierₒₚₜ identifier
45
+ class-key simple-template-id
46
+ class-key nested-name-specifier templateₒₚₜ simple-template-id
47
  ```
48
 
49
  Any unqualified lookup for the *identifier* (in the first case) does not
50
+ consider scopes that contain the nearest enclosing namespace or block
51
+ scope; no name is bound.
52
 
53
  [*Note 1*: A *using-directive* in the target scope is ignored if it
54
+ refers to a namespace not contained by that scope. — *end note*]
 
 
55
 
56
+ [*Note 2*: [[basic.lookup.elab]] describes how name lookup proceeds in
57
+ an *elaborated-type-specifier*. An *elaborated-type-specifier* can be
58
+ used to refer to a previously declared *class-name* or *enum-name* even
59
+ if the name has been hidden by a non-type declaration. — *end note*]
60
 
61
+ If the *identifier* or *simple-template-id* in an
62
+ *elaborated-type-specifier* resolves to a *class-name* or *enum-name*,
63
+ the *elaborated-type-specifier* introduces it into the declaration the
64
+ same way a *simple-type-specifier* introduces its *type-name*
65
+ [[dcl.type.simple]]. If the *identifier* or *simple-template-id*
66
+ resolves to a *typedef-name* [[dcl.typedef]], [[temp.names]], the
67
+ *elaborated-type-specifier* is ill-formed.
68
 
69
  [*Note 3*:
70
 
71
  This implies that, within a class template with a template
72
  *type-parameter* `T`, the declaration
73
 
74
  ``` cpp
75
  friend class T;
76
  ```
77
 
78
+ is ill-formed. However, the similar declaration `friend T;` is
79
+ well-formed [[class.friend]].
80
 
81
  — *end note*]
82
 
83
+ The *class-key* or `enum` keyword present in an
84
  *elaborated-type-specifier* shall agree in kind with the declaration to
85
  which the name in the *elaborated-type-specifier* refers. This rule also
86
  applies to the form of *elaborated-type-specifier* that declares a
87
  *class-name* or friend class since it can be construed as referring to
88
  the definition of the class. Thus, in any *elaborated-type-specifier*,