tmp/tmp2nnv9h75/{from.md → to.md}
RENAMED
|
@@ -19,14 +19,40 @@ unspecified which are and under what circumstances.[^3]
|
|
| 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|
|
@@ -42,11 +68,11 @@ 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
|
| 48 |
|
| 49 |
Translation unit #1
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
export module M:A;
|
|
@@ -93,11 +119,11 @@ void g() { f(); } // error: no reachable definition of struct B
|
|
| 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
|
| 99 |
|
| 100 |
Translation unit #1
|
| 101 |
|
| 102 |
``` cpp
|
| 103 |
export module A;
|
|
@@ -125,13 +151,17 @@ X x; // error: X not visible to unqualified lookup
|
|
| 125 |
[cpp.include]: cpp.md#cpp.include
|
| 126 |
[cpp.pre]: cpp.md#cpp.pre
|
| 127 |
[dcl.inline]: dcl.md#dcl.inline
|
| 128 |
[dcl.link]: dcl.md#dcl.link
|
| 129 |
[dcl.spec.auto]: dcl.md#dcl.spec.auto
|
|
|
|
| 130 |
[headers]: library.md#headers
|
| 131 |
[lex.name]: lex.md#lex.name
|
| 132 |
[lex.phases]: lex.md#lex.phases
|
|
|
|
|
|
|
|
|
|
| 133 |
[module]: #module
|
| 134 |
[module.context]: #module.context
|
| 135 |
[module.global.frag]: #module.global.frag
|
| 136 |
[module.import]: #module.import
|
| 137 |
[module.interface]: #module.interface
|
|
|
|
| 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 |
+
- P is a non-synthesized point and
|
| 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*; or
|
| 29 |
+
- D is the injected declaration for which P is the corresponding
|
| 30 |
+
synthesized point.
|
| 31 |
+
|
| 32 |
+
[*Example 1*:
|
| 33 |
+
|
| 34 |
+
``` cpp
|
| 35 |
+
class Incomplete;
|
| 36 |
+
|
| 37 |
+
consteval {
|
| 38 |
+
int n = nonstatic_data_members_of(
|
| 39 |
+
define_aggregate(^^Incomplete, {data_member_spec(^^int, {.name="x"})}),
|
| 40 |
+
std::meta::access_context::current()
|
| 41 |
+
).size();
|
| 42 |
+
|
| 43 |
+
Incomplete y; // error: type of y is incomplete
|
| 44 |
+
}
|
| 45 |
+
/* P */
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
The value of `n` is 1. The member `Incomplete::x` members-of-precedes
|
| 49 |
+
[[meta.reflection.member.queries]] the synthesized point P associated
|
| 50 |
+
with the injected declaration produced by the call to
|
| 51 |
+
`define_aggregate`.
|
| 52 |
+
|
| 53 |
+
— *end example*]
|
| 54 |
|
| 55 |
A declaration is *reachable* if it is reachable from any point in the
|
| 56 |
instantiation context [[module.context]].
|
| 57 |
|
| 58 |
[*Note 3*: Whether a declaration is exported has no bearing on whether
|
|
|
|
| 68 |
definitions, initializers, default arguments of functions or template
|
| 69 |
declarations, attributes, names bound, etc. Since default arguments are
|
| 70 |
evaluated in the context of the call expression, the reachable semantic
|
| 71 |
properties of the corresponding parameter types apply in that context.
|
| 72 |
|
| 73 |
+
[*Example 2*:
|
| 74 |
|
| 75 |
Translation unit #1
|
| 76 |
|
| 77 |
``` cpp
|
| 78 |
export module M:A;
|
|
|
|
| 119 |
— *end note*]
|
| 120 |
|
| 121 |
[*Note 5*: Declarations of an entity can be reachable even where they
|
| 122 |
cannot be found by name lookup. — *end note*]
|
| 123 |
|
| 124 |
+
[*Example 3*:
|
| 125 |
|
| 126 |
Translation unit #1
|
| 127 |
|
| 128 |
``` cpp
|
| 129 |
export module A;
|
|
|
|
| 151 |
[cpp.include]: cpp.md#cpp.include
|
| 152 |
[cpp.pre]: cpp.md#cpp.pre
|
| 153 |
[dcl.inline]: dcl.md#dcl.inline
|
| 154 |
[dcl.link]: dcl.md#dcl.link
|
| 155 |
[dcl.spec.auto]: dcl.md#dcl.spec.auto
|
| 156 |
+
[expr.const]: expr.md#expr.const
|
| 157 |
[headers]: library.md#headers
|
| 158 |
[lex.name]: lex.md#lex.name
|
| 159 |
[lex.phases]: lex.md#lex.phases
|
| 160 |
+
[meta.reflection]: meta.md#meta.reflection
|
| 161 |
+
[meta.reflection.define.aggregate]: meta.md#meta.reflection.define.aggregate
|
| 162 |
+
[meta.reflection.member.queries]: meta.md#meta.reflection.member.queries
|
| 163 |
[module]: #module
|
| 164 |
[module.context]: #module.context
|
| 165 |
[module.global.frag]: #module.global.frag
|
| 166 |
[module.import]: #module.import
|
| 167 |
[module.interface]: #module.interface
|