[Bug c++/99227] [meta] [modules] Bugs relating to header-units of STL header files

alexander.lelyakin at googlemail dot com gcc-bugzilla@gcc.gnu.org
Sat Mar 6 10:08:00 GMT 2021


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

Alexander Lelyakin <alexander.lelyakin at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alexander.lelyakin@googlema
                   |                            |il.com

--- Comment #1 from Alexander Lelyakin <alexander.lelyakin at googlemail dot com> ---
Just want to express my current understanding of situation.

Here:

https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Modules.html#C_002b_002b-Modules

is stated:
"The Standard Library is not provided as importable header units. If you want
to import such units, you must explicitly build them first. If you do not do
this with care, you may have multiple declarations, which the module machinery
must merge—compiler resource usage can be affected by how you partition header
files into header units."


Any header file in "/usr[/local]/include/c++/11[.0.1]" can be precompiled as a
header module like:
----
g++ -std=c++20 -fmodules-ts -x c++-system-header iostream
----
And can be successfully used as:
----
import <iostream>;

int main()
{
  std::cout<<"Hello\n";
  return 0;
}
----
g++ -std=c++20 -fmodules-ts test.c++
----

However if you will compile more than one header into the same 'gcm.cache'
directory, you will receive various compiler errors depending of order of
compilation of headers.

Currently there is no way to compile all headers. Longest sequence i have seen
so far was 35 headers, shortest - just 2.

This meta bug will accumulate bug reports discovered during attempts to
precompile system headers.


More information about the Gcc-bugs mailing list