This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-20


2971. Specializations for a class are not decl-reachable

Section: 10.4  [module.global.frag]     Status: open     Submitter: Davis Herring     Date: 2024-12-19

(From submission #655.)

Consider:

  module;
  // included...
  template<int> struct X {};
  template<> struct X<0> {};
  struct Z;
  template<class> struct Y {};
  template<> struct Y<Z> {};
  // ...done
  export module M;
  export using ::X;
  export using ::Z;

Subclause 10.4 [module.global.frag] bullet 3.5.7 implies that X<0>, but not Y<Z> is reachable in importers. This is not helpful when Y is a trait defined by another library and specialized for the library being exposed as M.

Possible resolution:

Change in 10.4 [module.global.frag] bullet 3.5 as follows:

A declaration D is decl-reachable from a declaration S in the same translation unit if