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

Nathaniel Shead <nshead at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-09-25
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |nshead at gcc dot gnu.org

--- Comment #1 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Confirmed.  The issue is exposed because of how <execution> and <algorithm>
include each other; <execution> then <algorithm> works because execution
includes all of algorithm internally anyway, but not the other way around. 
Minimised:

  // a.h
  template <typename T> void foo();

  // b.h
  import "a.h";
  template <typename T> void foo() {}

  // c.cpp
  import "b.h";
  int main() {
    foo<int>();
  }

'g++ -fmodules-ts a.h b.h c.cpp':

/usr/bin/ld: /tmp/ccZb7te8.o: in function `main':
x.cpp:(.text+0x5): undefined reference to `void foo<int>()'
collect2: error: ld returned 1 exit status

It looks like we don't export template definitions if we've already imported a
matching declaration.

Reply via email to