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

            Bug ID: 110447
           Summary: [modules] unexpected attachment of GMF decls to a
                    named module.
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: iains at gcc dot gnu.org
  Target Milestone: ---

While trying to compare behaviour of GCC and clang ....

====

Foo.cpp:

module;

#include <iostream>

export module Foo;

export void
my_hello (const char *str)
{
 std::cout << str << std::endl;
}

====
pr61465.cpp:

import Foo; // assume module 'foo' contain the declarations from `<iostream>`
#include <iostream>

int main(int argc, char *argv[])
{
    std::cout << "Test\n";
    my_hello ("and we used Foo");
    return 0;
}

====

g++ -std=c++20 -fmodules-ts Foo.cpp -c
g++ -std=c++20 -fmodules-ts pr6145-main.cpp Foo.o -o t -flang-info-module-cmi

...

In module imported at pr6145-main.cpp:1:1:
Foo: note: reading CMI ‘gcm.cache/Foo.gcm’

<snip include stack traceback>
/usr/include/runetype.h:111:20: error: conflicting declaration ‘_RuneLocale
_DefaultRuneLocale’

<snip include stack traceback>
/usr/include/runetype.h:111:20: note: previous declaration as ‘_RuneLocale@Foo
_DefaultRuneLocale@Foo’

====

NOTE: iostream is _not_ built as a header unit in this case (if we do that the
problem disappears).

----

What seems wrong here is that the _RuneLocale symbol appears to be attached to
Foo - but ir should be part of the GMF of Foo and not visible to importers
(although potentially reachable if used in the module purview of Foo).

unless i miss something?

Reply via email to