Created on 2022-12-09.00:00:00 last changed 16 months ago
Proposed resolution (approved by CWG 2023-01-06):
Change in 10.3 [module.import] paragraph 7 as follows:
... These rules can in turn lead to the importation of yet more translation units. [ Note: Such indirect importation does not make macros available, because a translation unit is a sequence of tokens in translation phase 7 (5.2 [lex.phases]). Macros can be made available by directly importing header units as described in 15.5 [cpp.import]. -- end note ]
Add to the example in 15.5 [cpp.import] paragraph 8 as follows:
import "a.h"; // point of definition of #1, #2, and #3, point of undefinition of #1 in "e.h" import "d.h"; // point of definition of #4 and #5 in "e.h" int a = Y; // OK, active macro definitions #2 and #4 are valid redefinitions int c = Z; // error: active macro definitions #3 and #5 are not valid redefinitions of ZModule unit f:export module f; export import "a.h"; int a = Y; // OK
Translation unit #1:import f; int x = Y; // error: Y is neither a defined macro nor a declared name-- end example ]
[Accepted as a DR at the February, 2023 meeting.]
It should be clarified via an example or a note that named module imports do not make macros available.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-07-16 13:00:43 | admin | set | status: open -> c++23 |
2023-07-16 13:00:43 | admin | set | status: dr -> open |
2023-02-18 18:43:04 | admin | set | status: ready -> dr |
2023-01-07 14:27:01 | admin | set | messages: + msg7120 |
2023-01-07 14:27:01 | admin | set | status: open -> ready |
2022-12-17 19:35:19 | admin | set | messages: - msg7096 |
2022-12-16 23:08:46 | admin | set | status: review -> open |
2022-12-09 22:41:41 | admin | set | status: open -> review |
2022-12-09 22:40:08 | admin | set | messages: + msg7096 |
2022-12-09 00:00:00 | admin | create |