From Jason Turner

[module.reach]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp3st_7tmb/{from.md → to.md} +21 -22
tmp/tmp3st_7tmb/{from.md → to.md} RENAMED
@@ -1,34 +1,36 @@
1
  ## Reachability <a id="module.reach">[[module.reach]]</a>
2
 
3
  A translation unit U is *necessarily reachable* from a point P if U is a
4
  module interface unit on which the translation unit containing P has an
5
  interface dependency, or the translation unit containing P imports U, in
6
- either case prior to P ([[module.import]]).
7
 
8
  [*Note 1*: While module interface units are reachable even when they
9
  are only transitively imported via a non-exported import declaration,
10
- namespace-scope names from such module interface units are not visible
11
- to name lookup [[basic.scope.namespace]]. — *end note*]
12
 
13
- All translation units that are necessarily reachable are *reachable*. It
14
- is unspecified whether additional translation units on which the point
15
- within the program has an interface dependency are considered reachable,
16
- and under what circumstances. [^3]
17
 
18
  [*Note 2*: It is advisable to avoid depending on the reachability of
19
  any additional translation units in programs intending to be
20
  portable. — *end note*]
21
 
22
- A declaration D is *reachable* if, for any point P in the instantiation
23
- context [[module.context]],
24
 
25
  - D appears prior to P in the same translation unit, or
26
  - D is not discarded [[module.global.frag]], appears in a translation
27
  unit that is reachable from P, and does not appear within a
28
  *private-module-fragment*.
29
 
 
 
 
30
  [*Note 3*: Whether a declaration is exported has no bearing on whether
31
  it is reachable. — *end note*]
32
 
33
  The accumulated properties of all reachable declarations of an entity
34
  within a context determine the behavior of the entity within that
@@ -36,14 +38,13 @@ context.
36
 
37
  [*Note 4*:
38
 
39
  These reachable semantic properties include type completeness, type
40
  definitions, initializers, default arguments of functions or template
41
- declarations, attributes, visibility of class or enumeration member
42
- names to ordinary lookup, etc. Since default arguments are evaluated in
43
- the context of the call expression, the reachable semantic properties of
44
- the corresponding parameter types apply in that context.
45
 
46
  [*Example 1*:
47
 
48
  Translation unit #1
49
 
@@ -80,22 +81,21 @@ export void f(B b = B());
80
  ```
81
 
82
  Translation unit #5
83
 
84
  ``` cpp
85
- module X;
86
  import M;
87
  B b3; // error: no reachable definition of struct B
88
  void g() { f(); } // error: no reachable definition of struct B
89
  ```
90
 
91
  — *end example*]
92
 
93
  — *end note*]
94
 
95
- [*Note 5*: An entity can have reachable declarations even if it is not
96
- visible to name lookup. — *end note*]
97
 
98
  [*Example 2*:
99
 
100
  Translation unit #1
101
 
@@ -106,23 +106,22 @@ export using Y = X;
106
  ```
107
 
108
  Translation unit #2
109
 
110
  ``` cpp
111
- module B;
112
  import A;
113
  Y y; // OK, definition of X is reachable
114
  X x; // error: X not visible to unqualified lookup
115
  ```
116
 
117
  — *end example*]
118
 
119
  <!-- Link reference definitions -->
120
  [basic.def.odr]: basic.md#basic.def.odr
121
  [basic.link]: basic.md#basic.link
 
122
  [basic.lookup.argdep]: basic.md#basic.lookup.argdep
123
- [basic.scope.namespace]: basic.md#basic.scope.namespace
124
  [class.compare.default]: class.md#class.compare.default
125
  [cpp.import]: cpp.md#cpp.import
126
  [cpp.include]: cpp.md#cpp.include
127
  [cpp.pre]: cpp.md#cpp.pre
128
  [dcl.inline]: dcl.md#dcl.inline
@@ -138,19 +137,19 @@ X x; // error: X not visible to unqualified lookup
138
  [module.interface]: #module.interface
139
  [module.private.frag]: #module.private.frag
140
  [module.reach]: #module.reach
141
  [module.unit]: #module.unit
142
  [namespace.udecl]: dcl.md#namespace.udecl
143
- [new.delete.array]: support.md#new.delete.array
144
- [new.delete.single]: support.md#new.delete.single
145
  [over.over]: over.md#over.over
146
  [special]: class.md#special
 
 
147
  [temp.point]: temp.md#temp.point
148
  [temp.pre]: temp.md#temp.pre
149
 
150
- [^1]: This is consistent with the rules for visibility of imported names
151
- [[basic.scope.namespace]].
152
 
153
  [^2]: A declaration can appear within a *lambda-expression* in the
154
  initializer of a variable.
155
 
156
  [^3]: Implementations are therefore not required to prevent the semantic
 
1
  ## Reachability <a id="module.reach">[[module.reach]]</a>
2
 
3
  A translation unit U is *necessarily reachable* from a point P if U is a
4
  module interface unit on which the translation unit containing P has an
5
  interface dependency, or the translation unit containing P imports U, in
6
+ either case prior to P [[module.import]].
7
 
8
  [*Note 1*: While module interface units are reachable even when they
9
  are only transitively imported via a non-exported import declaration,
10
+ namespace-scope names from such module interface units are not found by
11
+ name lookup [[basic.lookup]]. — *end note*]
12
 
13
+ All translation units that are necessarily reachable are *reachable*.
14
+ Additional translation units on which the point within the program has
15
+ an interface dependency may be considered reachable, but it is
16
+ unspecified which are and under what circumstances.[^3]
17
 
18
  [*Note 2*: It is advisable to avoid depending on the reachability of
19
  any additional translation units in programs intending to be
20
  portable. — *end note*]
21
 
22
+ A declaration D is *reachable from* a point P if
 
23
 
24
  - D appears prior to P in the same translation unit, or
25
  - D is not discarded [[module.global.frag]], appears in a translation
26
  unit that is reachable from P, and does not appear within a
27
  *private-module-fragment*.
28
 
29
+ A declaration is *reachable* if it is reachable from any point in the
30
+ instantiation context [[module.context]].
31
+
32
  [*Note 3*: Whether a declaration is exported has no bearing on whether
33
  it is reachable. — *end note*]
34
 
35
  The accumulated properties of all reachable declarations of an entity
36
  within a context determine the behavior of the entity within that
 
38
 
39
  [*Note 4*:
40
 
41
  These reachable semantic properties include type completeness, type
42
  definitions, initializers, default arguments of functions or template
43
+ declarations, attributes, names bound, etc. Since default arguments are
44
+ evaluated in the context of the call expression, the reachable semantic
45
+ properties of the corresponding parameter types apply in that context.
 
46
 
47
  [*Example 1*:
48
 
49
  Translation unit #1
50
 
 
81
  ```
82
 
83
  Translation unit #5
84
 
85
  ``` cpp
 
86
  import M;
87
  B b3; // error: no reachable definition of struct B
88
  void g() { f(); } // error: no reachable definition of struct B
89
  ```
90
 
91
  — *end example*]
92
 
93
  — *end note*]
94
 
95
+ [*Note 5*: Declarations of an entity can be reachable even where they
96
+ cannot be found by name lookup. — *end note*]
97
 
98
  [*Example 2*:
99
 
100
  Translation unit #1
101
 
 
106
  ```
107
 
108
  Translation unit #2
109
 
110
  ``` cpp
 
111
  import A;
112
  Y y; // OK, definition of X is reachable
113
  X x; // error: X not visible to unqualified lookup
114
  ```
115
 
116
  — *end example*]
117
 
118
  <!-- Link reference definitions -->
119
  [basic.def.odr]: basic.md#basic.def.odr
120
  [basic.link]: basic.md#basic.link
121
+ [basic.lookup]: basic.md#basic.lookup
122
  [basic.lookup.argdep]: basic.md#basic.lookup.argdep
 
123
  [class.compare.default]: class.md#class.compare.default
124
  [cpp.import]: cpp.md#cpp.import
125
  [cpp.include]: cpp.md#cpp.include
126
  [cpp.pre]: cpp.md#cpp.pre
127
  [dcl.inline]: dcl.md#dcl.inline
 
137
  [module.interface]: #module.interface
138
  [module.private.frag]: #module.private.frag
139
  [module.reach]: #module.reach
140
  [module.unit]: #module.unit
141
  [namespace.udecl]: dcl.md#namespace.udecl
 
 
142
  [over.over]: over.md#over.over
143
  [special]: class.md#special
144
+ [temp.decls.general]: temp.md#temp.decls.general
145
+ [temp.dep]: temp.md#temp.dep
146
  [temp.point]: temp.md#temp.point
147
  [temp.pre]: temp.md#temp.pre
148
 
149
+ [^1]: This is consistent with the lookup rules for imported names
150
+ [[basic.lookup]].
151
 
152
  [^2]: A declaration can appear within a *lambda-expression* in the
153
  initializer of a variable.
154
 
155
  [^3]: Implementations are therefore not required to prevent the semantic