cplusplus / CWG

Core Working Group
23 stars 7 forks source link

[basic.start.dynamic] p2 "prior" is not defined #446

Open xmh0511 opened 9 months ago

xmh0511 commented 9 months ago

Full name of submitter (unless configured in github; will be published with the issue): Jim X

[basic.start.dynamic] p2 says

A declaration D is appearance-ordered before a declaration E if

  • D appears in the same translation unit as E, or
  • the translation unit containing E has an interface dependency on the translation unit containing D,

in either case prior to E.

"prior" may be simpler to understand if D and E appear in the same TU, which may mean D appears in the precede position than E in the source code. However, what if they appear in different TUs?

/// TU A
export module M;
export int D =0;

/// TU B
import A;
int E = 1;

It is not clear whether D in module M is said to be prior to E in module A.

Suggested Resolution

We may need to say D is reachable from E.