From Jason Turner

[basic.scope.pdecl]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp6mxe57q_/{from.md → to.md} +28 -19
tmp/tmp6mxe57q_/{from.md → to.md} RENAMED
@@ -1,25 +1,27 @@
1
  ### Point of declaration <a id="basic.scope.pdecl">[[basic.scope.pdecl]]</a>
2
 
3
  The *point of declaration* for a name is immediately after its complete
4
- declarator (Clause  [[dcl.decl]]) and before its *initializer* (if any),
5
- except as noted below.
6
 
7
  [*Example 1*:
8
 
9
  ``` cpp
10
  unsigned char x = 12;
11
  { unsigned char x = x; }
12
  ```
13
 
14
- Here the second `x` is initialized with its own (indeterminate) value.
 
 
15
 
16
  — *end example*]
17
 
18
  [*Note 1*:
19
 
20
- a name from an outer scope remains visible up to the point of
21
  declaration of the name that hides it.
22
 
23
  [*Example 2*:
24
 
25
  ``` cpp
@@ -33,20 +35,20 @@ declares a block-scope array of two integers.
33
 
34
  — *end note*]
35
 
36
  The point of declaration for a class or class template first declared by
37
  a *class-specifier* is immediately after the *identifier* or
38
- *simple-template-id* (if any) in its *class-head* (Clause  [[class]]).
39
- The point of declaration for an enumeration is immediately after the
40
- *identifier* (if any) in either its *enum-specifier* ([[dcl.enum]]) or
41
- its first *opaque-enum-declaration* ([[dcl.enum]]), whichever comes
42
- first. The point of declaration of an alias or alias template
43
- immediately follows the *type-id* to which the alias refers.
44
 
45
  The point of declaration of a *using-declarator* that does not name a
46
- constructor is immediately after the *using-declarator* (
47
- [[namespace.udecl]]).
48
 
49
  The point of declaration for an enumerator is immediately after its
50
  *enumerator-definition*.
51
 
52
  [*Example 3*:
@@ -101,17 +103,24 @@ The point of declaration of a class first declared in an
101
  \[*Note 3*: These rules also apply within templates. — *end note*]
102
  \[*Note 4*: Other forms of *elaborated-type-specifier* do not declare
103
  a new name, and therefore must refer to an existing *type-name*. See 
104
  [[basic.lookup.elab]] and  [[dcl.type.elab]]. — *end note*]
105
 
106
- The point of declaration for an *injected-class-name* (Clause 
107
- [[class]]) is immediately following the opening brace of the class
108
- definition.
109
 
110
- The point of declaration for a function-local predefined variable (
111
- [[dcl.fct.def]]) is immediately before the *function-body* of a function
112
- definition.
 
 
 
 
 
 
 
 
113
 
114
  The point of declaration for a template parameter is immediately after
115
  its complete *template-parameter*.
116
 
117
  [*Example 4*:
@@ -126,11 +135,11 @@ template<class T
126
 
127
  — *end example*]
128
 
129
  [*Note 5*: Friend declarations refer to functions or classes that are
130
  members of the nearest enclosing namespace, but they do not introduce
131
- new names into that namespace ([[namespace.memdef]]). Function
132
  declarations at block scope and variable declarations with the `extern`
133
  specifier at block scope refer to declarations that are members of an
134
  enclosing namespace, but they do not introduce new names into that
135
  scope. — *end note*]
136
 
 
1
  ### Point of declaration <a id="basic.scope.pdecl">[[basic.scope.pdecl]]</a>
2
 
3
  The *point of declaration* for a name is immediately after its complete
4
+ declarator [[dcl.decl]] and before its *initializer* (if any), except as
5
+ noted below.
6
 
7
  [*Example 1*:
8
 
9
  ``` cpp
10
  unsigned char x = 12;
11
  { unsigned char x = x; }
12
  ```
13
 
14
+ Here, the initialization of the second `x` has undefined behavior,
15
+ because the initializer accesses the second `x` outside its lifetime
16
+ [[basic.life]].
17
 
18
  — *end example*]
19
 
20
  [*Note 1*:
21
 
22
+ A name from an outer scope remains visible up to the point of
23
  declaration of the name that hides it.
24
 
25
  [*Example 2*:
26
 
27
  ``` cpp
 
35
 
36
  — *end note*]
37
 
38
  The point of declaration for a class or class template first declared by
39
  a *class-specifier* is immediately after the *identifier* or
40
+ *simple-template-id* (if any) in its *class-head* [[class.pre]]. The
41
+ point of declaration for an enumeration is immediately after the
42
+ *identifier* (if any) in either its *enum-specifier* [[dcl.enum]] or its
43
+ first *opaque-enum-declaration* [[dcl.enum]], whichever comes first. The
44
+ point of declaration of an alias or alias template immediately follows
45
+ the *defining-type-id* to which the alias refers.
46
 
47
  The point of declaration of a *using-declarator* that does not name a
48
+ constructor is immediately after the *using-declarator*
49
+ [[namespace.udecl]].
50
 
51
  The point of declaration for an enumerator is immediately after its
52
  *enumerator-definition*.
53
 
54
  [*Example 3*:
 
103
  \[*Note 3*: These rules also apply within templates. — *end note*]
104
  \[*Note 4*: Other forms of *elaborated-type-specifier* do not declare
105
  a new name, and therefore must refer to an existing *type-name*. See 
106
  [[basic.lookup.elab]] and  [[dcl.type.elab]]. — *end note*]
107
 
108
+ The point of declaration for an injected-class-name [[class.pre]] is
109
+ immediately following the opening brace of the class definition.
 
110
 
111
+ The point of declaration for a function-local predefined variable
112
+ [[dcl.fct.def.general]] is immediately before the *function-body* of a
113
+ function definition.
114
+
115
+ The point of declaration of a structured binding [[dcl.struct.bind]] is
116
+ immediately after the *identifier-list* of the structured binding
117
+ declaration.
118
+
119
+ The point of declaration for the variable or the structured bindings
120
+ declared in the *for-range-declaration* of a range-based `for` statement
121
+ [[stmt.ranged]] is immediately after the *for-range-initializer*.
122
 
123
  The point of declaration for a template parameter is immediately after
124
  its complete *template-parameter*.
125
 
126
  [*Example 4*:
 
135
 
136
  — *end example*]
137
 
138
  [*Note 5*: Friend declarations refer to functions or classes that are
139
  members of the nearest enclosing namespace, but they do not introduce
140
+ new names into that namespace [[namespace.memdef]]. Function
141
  declarations at block scope and variable declarations with the `extern`
142
  specifier at block scope refer to declarations that are members of an
143
  enclosing namespace, but they do not introduce new names into that
144
  scope. — *end note*]
145