P0713R1, 2018-02-08
EWG, CWG


Daveed Vandevoorde (daveed@edg.com)

Identifying Module Source

P0713R0 argued for requiring a leading syntactic marker to distinguish module units from traditional translation units that are not module units. Discussion in Toronto concluded with a vote that supported that direction (strongly favor: 3, favor: 18, neutral: 14, against: 3, strongly against: 0) after the publication of the modules TS (now N4720). This paper proposes wording specifically for implementing the leading marker as the strawman proposal in P0713R0:

  module;
  ...
  export module X;
  ...

Changes to N4720

Change the definition of translation-unit in paragraph 6.5/1 [basic.link] to:

translation-unit:
declaration-seqopt
module-unitopt

module-unit:
single-module-unit
mixed-module-unit

single-module-unit:
module-declaration declaration-seqopt

mixed-module-unit:
module ; declaration-seqopt single-module-unit

and remove the definitions of toplevel-declaration-seq and toplevel-declaration.

In [dcl.module.unit] 10.7.1 paragraph 1, delete one sentence as follows:

  1. A module unit is a translation unit that contains a module-declaration. A named module is the collection of module units with the same module-name. A translation unit shall not contain more than one module-declaration. A module-name has external linkage but cannot be found by name lookup.