15 Preprocessing directives [cpp]

15.5 Module directive [cpp.module]

pp-module:
export module pp-tokens new-line
The pp-tokens, if any, of a pp-module shall be of the form: where the grammar non-terminals are defined as: No identifier in the pp-module-name or pp-module-partition shall currently be defined as an object-like macro or followed by ( as the next preprocessing token at the start of phase 4 of translation ([lex.phases]).
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.
[Example 1: 

Importable header "common.h":#define DOT_BAR .bar #define MOD_ATTR [[vendor::shiny_module]]

Translation unit #1:module; #include "common.h" export module foo DOT_BAR; // error: expansion of DOT_BAR; does not begin with ; or [

Translation unit #2:module; #include "common.h" export module M MOD_ATTR ; // OK — end example]

[Example 2: export module a .b; // error: preprocessing token after pp-module-name is not ; or [ — end example]
[Example 3: export module M [[ attr1, attr2 ]] ; // OK — end example]
[Example 4: export module M [[ attr1, attr2 ]] ; // OK — end example]
[Example 5: export module M; int n; // OK — end example]