[Bug c++/102341] [modules] alias-declaration and typedef-declaration conflict in module interface unit

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 15 10:34:37 GMT 2021


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It seems to happen for almost any redeclaration if the initial definition
wasn't exported:

export module test;
namespace Test
{
  template<typename T> constexpr void f(T) { }
  export template<typename T> constexpr void f(T);
}


mod.cc:5:49: error: conflicting exporting declaration 'template<class T>
constexpr void Test::f(T)'
    5 |   export template<typename T> constexpr void f(T);
      |                                                 ^
mod.cc:4:39: note: previous declaration 'template<class T> constexpr void
Test::f(T)' here
    4 |   template<typename T> constexpr void f(T) { }
      |                                       ^
mod.cc:1:8: warning: not writing module 'test' due to errors
    1 | export module test;
      |        ^~~~~~



This seems to make it impractical to create a module interface unit for any
library that is currently defined in header files, such as libstdc++.


More information about the Gcc-bugs mailing list