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

            Bug ID: 123797
           Summary: Header Unit Not Found In Preprocessed File
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kongmingd234 at proton dot me
  Target Milestone: ---

Created attachment 63475
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63475&action=edit
This code compiles fine directly, but fails when compiled in two steps.

Importing a header unit works just fine during normal compilation. However, it
breaks if you preprocess first and then compile the preprocessed file.

The file was compiled using the following module mapper

a a.gcm
b b.gcm
/usr/local/src/gcc/installed-here/include/c++/16.0.0/print print.gcm
/usr/local/src/gcc/installed-here/include/c++/16.0.0/string_view
string_view.gcm
/usr/local/src/gcc/installed-here/include/c++/16.0.0/vector vector.gcm

Preprocessing with -E causes no errors and produces main.ii.
But then, compiling main.ii fails to find the header units, the modules a and b
are found just fine. However, it appears that changing the import statement to
use the absolute path of the header works just fine.

I propose for the preprocessor to change all the import statements to use
absolute paths. This makes the most sense in my opinion.

Reply via email to