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

            Bug ID: 116364
           Summary: [modules] GM explicit specialisation not propagated
                    from partition
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nshead at gcc dot gnu.org
            Blocks: 103524
  Target Milestone: ---

Consider the following:

  // a.cpp
  module;
  template <typename> struct S {};
  template<> struct S<int> { static constexpr bool value = true; };
  export module foo:part;
  export template <typename T> constexpr bool result = S<T>::value;

  // b.cpp
  export module foo;
  export import :part;

  // c.cpp
  import foo;
  bool x = result<int>;


Doing 'g++ -fmodules-ts -Wno-global-module -S [abc].cpp' gives:

In file included from b.cpp:2:8,
of module foo, imported at c.cpp:1:
a.cpp: In instantiation of ‘constexpr const bool result@foo<int>’:
c.cpp:2:10:   required from here
    2 | bool x = result<int>;
      |          ^~~~~~~~~~~
a.cpp:5:62: error: ‘value’ is not a member of ‘S@foo<int>’
    5 |   export template <typename T> constexpr bool result = S<T>::value;
      |                                                              ^~~~~

Doing the instantiation within 'b.cpp' works successfully; it looks like
explicit specialisations are not correctly being propagated through partitions.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103524
[Bug 103524] [meta-bug] modules issue

Reply via email to