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

            Bug ID: 125787
           Summary: [modules] Including headers and using modules with
                    -freflection enabled causes conflicting imported
                    declarations
           Product: gcc
           Version: 16.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: keipitalists at proton dot me
  Target Milestone: ---

Created attachment 64736
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64736&action=edit
Compilation error output + gcc -v output

If a module includes certain headers with typedef'd structures in the global
module fragment, and is imported from a file that also includes the same
headers, compilation fails due to conflicting declarations, when compiled with
-freflection.

Example:
//my_module.cpp
module;
#include <string>

export module my_module;

std::string my_function();


//a.cpp
#include <string>

import my_module;


Compilation fails with: g++ -fmodules-ts -freflection -c -std=c++26 
./my_module.cpp ./a.cpp
Compilation succeeds with: g++ -fmodules-ts -c -std=c++26  ./my_module.cpp
./a.cpp

Reply via email to