Created on 2024-06-20.00:00:00 last changed 1 month ago
Additional notes (January, 2025)
Partially reverted in issue 2990.
Proposed resolution (approved by CWG 2024-08-16):
Change in 10.2 [module.interface] paragraph 6 as follows:
A redeclaration of an entity X is implicitly exported if X was introduced by an exported declaration; otherwise it shall not be exported if it is attached to a named module.
[Accepted as a DR at the November, 2024 meeting.]
Consider:
  export module mod;
  extern "C++" void func();
  export extern "C++" {
    void func();
  }
Per 10.2 [module.interface] paragraph 6, this is currently ill-formed, but implementation treatment varies and there seems to be little rationale why this should be ill-formed for entities not attached to a named module.
The rule also makes the following example ill-formed, which was intended to be well-formed:
  export module M;
  namespace N { // external linkage, attached to global module, not exported
    void f();
  }
  namespace N { // error: exported namespace, redeclares non-exported namespace
    export void g();
  }
The mental model here is that for an entity not attached to a named module, exportedness is not a meaningful property of that entity.
| History | |||
|---|---|---|---|
| Date | User | Action | Args | 
| 2025-09-12 22:42:26 | admin | set | status: open -> cd7 | 
| 2025-09-12 22:42:26 | admin | set | status: drwp -> open | 
| 2025-04-13 20:07:31 | admin | set | status: dr -> drwp | 
| 2025-01-28 15:04:14 | admin | set | messages: + msg7958 | 
| 2024-12-17 09:54:02 | admin | set | status: ready -> dr | 
| 2024-11-19 12:36:26 | admin | set | status: tentatively ready -> ready | 
| 2024-08-16 19:45:15 | admin | set | messages: + msg7799 | 
| 2024-08-16 19:45:15 | admin | set | status: open -> tentatively ready | 
| 2024-06-20 00:00:00 | admin | create | |