Author: Mathias Stearn
This change is intended to prevent
import declarations in the global module fragment of a module unit from being implicitly imported when other units of the same module import that unit. Other NB comment resolutions will ensure that such
import declarations must come from
#include expansion (possibly by translation to an
import) and must not be explictlity
This is believed to be an unintentional change in behavior from the Modules TS caused by a change in specification mechanisms.
// uses_vector.h import <vector>; // Could be from a translated #include // partition.cpp module; #include "uses_vector.h" // textually expands to import <vector>; module A:partition; // interface.cpp module A; import :partition; std::vector<int> x;
This change makes the last line ill-formed because it refers to
std::vector which is not visible. Previously the
<vector> was implicitly imported into the
interface.cpp translation unit.
Modify 10.3 [module.import] paragraph 6 as follows:
When a module-import-declaration imports a translation unit T, it also imports all translation units imported by exported module-import-declarations in T; such translation units are said to be exported by T.
When a module-import-declaration in a module unit imports another module unit of the same module, it also imports all translation units imported by allmodule-import-declarations in that module unit. These rules may in turn lead to the importation of yet more translation units.