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

            Bug ID: 118049
           Summary: conflicting global module declaration
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: furyusss at yahoo dot fr
  Target Milestone: ---

Created attachment 59872
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59872&action=edit
3 source files

I get the following error:

```
In file included from /home/installdir/include/c++/15.0.0/ostream:45,
                 from /home/installdir/include/c++/15.0.0/bits/unique_ptr.h:43,
                 from /home/installdir/include/c++/15.0.0/bits/std_thread.h:45,
                 from /home/installdir/include/c++/15.0.0/stop_token:40,
                 from /home/installdir/include/c++/15.0.0/thread:44,
                 from module2.cpp:3,
of module module2, imported at module2_impl.cpp:6:
/home/installdir/include/c++/15.0.0/format:2709:7: error: conflicting global
module declaration ‘auto
std::__format::_Sink_iter@module2<_CharT>::_M_reserve(std::size_t) const [with
_CharT = char; std::size_t = long unsigned int]’
 2709 |       _M_reserve(size_t __n) const
      |       ^~~~~~~~~~
In file included from /home/installdir/include/c++/15.0.0/ostream:45,
                 from /home/installdir/include/c++/15.0.0/bits/unique_ptr.h:43,
                 from /home/installdir/include/c++/15.0.0/memory:80,
                 from module1.cpp:4,
of module module1, imported at module2.cpp:8,
of module module2, imported at module2_impl.cpp:6:
/home/installdir/include/c++/15.0.0/format:2709:7: note: existing declaration
‘auto std::__format::_Sink_iter@module2<_CharT>::_M_reserve(std::size_t) const
[with _CharT = char; std::size_t = long unsigned int]’
 2709 |       _M_reserve(size_t __n) const
      |       ^~~~~~~~~~
```

With `gcc version 14.2.0 (Ubuntu 14.2.0-4ubuntu2~24.04)`. I also tried the
trunk (7b5599dbd75fe1ee7d861d4cfc6ea655a126bef3).

I attached the 3 source files.

The commands I ran are:

```
g++ -O0 -g -std=c++23 -E -x c++ module2_impl.cpp -MT module2_impl.cpp.o.ddi -MD
-MF module2_impl.cpp.o.ddi.d -fmodules-ts -fdeps-file=module2_impl.cpp.o.ddi
-fdeps-target=module2_impl.cpp.o -fdeps-format=p1689r5 -o
module2_impl.cpp.o.ddi.i
g++ -O0 -g -std=c++23 -E -x c++ module1.cpp -MT module1.cpp.o.ddi -MD -MF
module1.cpp.o.ddi.d -fmodules-ts -fdeps-file=module1.cpp.o.ddi
-fdeps-target=module1.cpp.o -fdeps-format=p1689r5 -o module1.cpp.o.ddi.i 
g++ -O0 -g -std=c++23 -MD -MT module1.cpp.o -MF module1.cpp.o.d -fmodules-ts
-MD -fdeps-format=p1689r5 -x c++ -o module1.cpp.o -c module1.cpp
g++ -O0 -g -std=c++23 -E -x c++ module2.cpp -MT module2.cpp.o.ddi -MD -MF
module2.cpp.o.ddi.d -fmodules-ts -fdeps-file=module2.cpp.o.ddi
-fdeps-target=module2.cpp.o -fdeps-format=p1689r5 -o module2.cpp.o.ddi.i
g++ -O0 -g -std=c++23 -MD -MT module2.cpp.o -MF module2.cpp.o.d -fmodules-ts
-MD -fdeps-format=p1689r5 -x c++ -o module2.cpp.o -c module2.cpp
g++ -O0 -g -std=c++23 -MD -MT module2_impl.cpp.o -MF module2_impl.cpp.o.d
-fmodules-ts -MD -fdeps-format=p1689r5 -x c++ -o module2_impl.cpp.o -c
module2_impl.cpp
```

Reply via email to