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

--- Comment #3 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
And FWIW this was still problematic in GCC15; consider the following testcase
(which errors on GCC15):

  // a.cpp
  export module M;
  export extern "C++" template <typename> struct Type {
    constexpr static int arr[] = { 42, 43, 44 };
  };

  // b.cpp
  template <typename> struct Type {
    constexpr static int arr[] = { 42, 43, 44 };
  };
  import M;
  constexpr int x = sizeof(Type<int>::arr);

$ g++-15 -fmodules -S a.cpp b.cpp
In module M, imported at /home/wreien/m/h.cpp:4:
a.cpp:3:24: error: conflicting type for imported declaration ‘template<class>
constexpr const int Type< <template-parameter-1-1> >::arr [3]’
    3 |   constexpr static int arr[] = { 42, 43, 44 };
      |                        ^~~
b.cpp:2:24: note: existing declaration ‘template<class> constexpr const int
Type< <template-parameter-1-1> >::arr [3]’
    2 |   constexpr static int arr[] = { 42, 43, 44 };
      |                        ^~~
b.cpp:5:26: note: during load of binding ‘::Type@M’
    5 | constexpr int x = sizeof(Type<int>::arr);
      |                          ^~~~

Reply via email to