Full name of submitter (unless configured in github; will be published with the issue): Yin Xinyu
On the one hand, [cpp.module] says that (using [] to mean opt)
pp-module:
[export] module [pp-tokens] new-line
The pp-tokens, if any, of a pp-module shall be of the form:
pp-module-name [pp-module-partition] [pp-tokens]
...
The module and export (if it exists) preprocessing tokens are replaced by the module-keyword and export-keyword preprocessing tokens respectively.
[Note 1: This makes the line no longer a directive so it is not removed at the end of phase 4. —end note]
After this replacement, the preprocessing tokens that constituted the directive are a text-line and are processed as normal text.
[Note 2: No macro expansion is possible for the pp-module-name and pp-module-partition. —end note]
After such processing, there shall be a ; or [ preprocessing token following the pp-module-name and optional pp-module-partition.
Can we infer from these emphases and the subclause title "Module directive" that pp-module shall be a preprocessing directive ([cpp.pre]/2)?
a module preprocessing token immediately followed on the same logical source line by an identifier, : , or ; preprocessing token
If so, then the pp-tokens of a pp-module cannot be empty. In fact, [cpp.pre]/2 Example 1 has explicitly depicted
module // not a preprocessing directive
On the other hand, it's worth noting that pp-modules only cover the identifier case. The only occurences matching the other cases (module: and module;) are in the [cpp.pre] grammar
pp-global-module-fragment:
module ; new-line [group]
pp-private-module-fragment:
module : private ; new-line [group]
pp-global-module-fragment and pp-private-module-fragment are recognized as preprocessing directives by [cpp.pre]/2, but they are not pp-modules and therefore are not subject to the replacement specified in [cpp.module]/2. Since translation phase 4 subsequently deletes all preprocessing directives, what specification causes these two directives to remain as preprocessing tokens rather than being deleted?
Full name of submitter (unless configured in github; will be published with the issue): Yin Xinyu
On the one hand, [cpp.module] says that (using [] to mean opt)
Can we infer from these emphases and the subclause title "Module directive" that pp-module shall be a preprocessing directive ([cpp.pre]/2)?
If so, then the pp-tokens of a pp-module cannot be empty. In fact, [cpp.pre]/2 Example 1 has explicitly depicted
On the other hand, it's worth noting that pp-modules only cover the identifier case. The only occurences matching the other cases (
module:andmodule;) are in the [cpp.pre] grammarpp-global-module-fragment and pp-private-module-fragment are recognized as preprocessing directives by [cpp.pre]/2, but they are not pp-modules and therefore are not subject to the replacement specified in [cpp.module]/2. Since translation phase 4 subsequently deletes all preprocessing directives, what specification causes these two directives to remain as preprocessing tokens rather than being deleted?