https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120160

--- Comment #7 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
(In reply to Antony Polukhin from comment #6)
> (In reply to Nathaniel Shead from comment #5)
> > This has been done at the compiler level by r16-6012-g9783f6f2f67f94:
> > 
> >   c++/modules: #include <vector> -> import <bits/stdc++.h>
> > 
> > So this is sort of done I suppose.  Though it won't work if using say CMake,
> > which doesn't support building header units (as this translation is defined
> > in terms of).
> 
> That does the job, if it is safe to mix importing header units and `import
> std; ` in the same translation unit.

Yes, it should be safe; we have issues with the same declaration from an import
being made in a following #include, but any mixtures of imports (whether named
modules or header units) should behave sensibly.

In this case in particular, when using '--compile-std-module' then the 'std'
module was built in terms of <bits/stdc++.h> to start with, so '#include
<vector>' after 'import std;' will be effectively a no-op apart from making
some additional names in the (already transitively imported) <bits/stdc++.h>
header unit visible.

Reply via email to