[Bug c++/125768] [16/17 Regression] c++/modules: ICE (segfault build_special_member_call) on member-init of a module-attached class with dense members when 'import std'

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 23 17:34:40 GMT 2026


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

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
Reduced:

TU1----
export module api;
export struct S { };
export template <class T> struct A { };
export using a_s = A<S>;

TU2----
export module outer;
import api;
struct Outer {
  a_s mem;
  Outer();
};

TU3----
module outer;
Outer::Outer() {}

The issue is that A<S> is not instantiated in TU1, it is instantiated in TU2
but not written out, so it isn't read into TU3, and so when we try to
initialize mem in the constructor it still has an incomplete type.

We could instantiate in TU3 as well, but I think the right answer is to write
out the instantiation in TU2.

a_s corresponds to std::mt19937_64 in the original testcase.


More information about the Gcc-bugs mailing list