Date
2022-03-23.23:13:32
Message id
6750

Content

Suggested resolution:

  1. Change 6.9.3.1 [basic.start.main] paragraph 1 as follows:

    A program shall contain exactly one function called main that belongs to the global scope and is attached to the global module. Executing a program starts a main thread of execution (6.9.2 [intro.multithread], 32.4 [thread.threads]) in which the main function is invoked. It is implementation-defined whether a program in a freestanding environment is required to define a main function.
  2. Change 10.1 [module.unit] bullet 7.2 as follows:

    • ...
    • Otherwise, if the declaration
      • is a replaceable global allocation or deallocation function (17.6.3.2 [new.delete.single], 17.6.3.3 [new.delete.array]), or
      • is a namespace-definition with external linkage, or
      • appears within a linkage-specification,
      it is attached to the global module.
    • Otherwise, ...
  3. Add an example at the end of 10.1 [module.unit] paragraph 7:

    [ Example:

      // Translation unit #1
      export module Foo;
      void f();              // module linkage, attached to named module Foo
      extern "C++" {
        export void g();     // nameable by importers
        void h();            // nameable in Foo's purview
      }
    

    Both g and h have external linkage, are attached to the global module, and can thus also be redeclared in other translation units:

      // Legacy header "foo.h"
      extern "C++" void g();
    
      // Legacy header "foo-internal.h"
      extern "C++" void h();
    

    -- end example ]

    A module-declaration that contains neither...

  4. 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 unless it has external linkage..