From Jason Turner

[basic.scope.declarative]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpxo02_df_/{from.md → to.md} +19 -15
tmp/tmpxo02_df_/{from.md → to.md} RENAMED
@@ -1,10 +1,10 @@
1
  ### Declarative regions and scopes <a id="basic.scope.declarative">[[basic.scope.declarative]]</a>
2
 
3
  Every name is introduced in some portion of program text called a
4
  *declarative region*, which is the largest part of the program in which
5
- that name is *valid*, that is, in which that name may be used as an
6
  unqualified name to refer to the same entity. In general, each
7
  particular name is valid only within some possibly discontiguous portion
8
  of program text called its *scope*. To determine the scope of a
9
  declaration, it is sometimes convenient to refer to the *potential
10
  scope* of a declaration. The scope of a declaration is the same as its
@@ -37,37 +37,41 @@ same as its potential scope.
37
 
38
  — *end example*]
39
 
40
  The names declared by a declaration are introduced into the scope in
41
  which the declaration occurs, except that the presence of a `friend`
42
- specifier ([[class.friend]]), certain uses of the
43
- *elaborated-type-specifier* ([[dcl.type.elab]]), and
44
- *using-directive*s ([[namespace.udir]]) alter this general behavior.
45
 
46
  Given a set of declarations in a single declarative region, each of
47
  which specifies the same unqualified name,
48
 
49
  - they shall all refer to the same entity, or all refer to functions and
50
  function templates; or
51
  - exactly one declaration shall declare a class name or enumeration name
52
  that is not a typedef name and the other declarations shall all refer
53
  to the same variable, non-static data member, or enumerator, or all
54
  refer to functions and function templates; in this case the class name
55
- or enumeration name is hidden ([[basic.scope.hiding]]). \[*Note 1*: A
56
- namespace name or a class template name must be unique in its
57
- declarative region ([[namespace.alias]], Clause 
58
- [[temp]]). — *end note*]
59
 
60
  [*Note 2*: These restrictions apply to the declarative region into
61
  which a name is introduced, which is not necessarily the same as the
62
  region in which the declaration occurs. In particular,
63
- *elaborated-type-specifier*s ([[dcl.type.elab]]) and friend
64
- declarations ([[class.friend]]) may introduce a (possibly not visible)
65
- name into an enclosing namespace; these restrictions apply to that
66
- region. Local extern declarations ([[basic.link]]) may introduce a name
67
- into the declarative region where the declaration appears and also
68
- introduce a (possibly not visible) name into an enclosing namespace;
69
- these restrictions apply to both regions. — *end note*]
 
 
 
 
70
 
71
  [*Note 3*: The name lookup rules are summarized in 
72
  [[basic.lookup]]. — *end note*]
73
 
 
1
  ### Declarative regions and scopes <a id="basic.scope.declarative">[[basic.scope.declarative]]</a>
2
 
3
  Every name is introduced in some portion of program text called a
4
  *declarative region*, which is the largest part of the program in which
5
+ that name is valid, that is, in which that name may be used as an
6
  unqualified name to refer to the same entity. In general, each
7
  particular name is valid only within some possibly discontiguous portion
8
  of program text called its *scope*. To determine the scope of a
9
  declaration, it is sometimes convenient to refer to the *potential
10
  scope* of a declaration. The scope of a declaration is the same as its
 
37
 
38
  — *end example*]
39
 
40
  The names declared by a declaration are introduced into the scope in
41
  which the declaration occurs, except that the presence of a `friend`
42
+ specifier [[class.friend]], certain uses of the
43
+ *elaborated-type-specifier* [[dcl.type.elab]], and *using-directive*s
44
+ [[namespace.udir]] alter this general behavior.
45
 
46
  Given a set of declarations in a single declarative region, each of
47
  which specifies the same unqualified name,
48
 
49
  - they shall all refer to the same entity, or all refer to functions and
50
  function templates; or
51
  - exactly one declaration shall declare a class name or enumeration name
52
  that is not a typedef name and the other declarations shall all refer
53
  to the same variable, non-static data member, or enumerator, or all
54
  refer to functions and function templates; in this case the class name
55
+ or enumeration name is hidden [[basic.scope.hiding]]. \[*Note 1*: A
56
+ structured binding [[dcl.struct.bind]], namespace name
57
+ [[basic.namespace]], or class template name [[temp.pre]] must be
58
+ unique in its declarative region. — *end note*]
59
 
60
  [*Note 2*: These restrictions apply to the declarative region into
61
  which a name is introduced, which is not necessarily the same as the
62
  region in which the declaration occurs. In particular,
63
+ *elaborated-type-specifier*s [[dcl.type.elab]] and friend declarations
64
+ [[class.friend]] may introduce a (possibly not visible) name into an
65
+ enclosing namespace; these restrictions apply to that region. Local
66
+ extern declarations [[basic.link]] may introduce a name into the
67
+ declarative region where the declaration appears and also introduce a
68
+ (possibly not visible) name into an enclosing namespace; these
69
+ restrictions apply to both regions. — *end note*]
70
+
71
+ For a given declarative region *R* and a point *P* outside *R*, the set
72
+ of *intervening* declarative regions between *P* and *R* comprises all
73
+ declarative regions that are or enclose *R* and do not enclose *P*.
74
 
75
  [*Note 3*: The name lookup rules are summarized in 
76
  [[basic.lookup]]. — *end note*]
77