https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118920
--- Comment #6 from Nathaniel Shead <nshead at gcc dot gnu.org> --- In particular, it looks like the issue is that the forward-declared `out_ptr` via <filesystem>'s instantiation of '__shared_ptr<__cxx11::_Impl>' inherits an abi_tag attribute, but the declaration in <memory> does not have it. The modules streaming code does not attempt to merge these two declarations together, and so we get the ICE when checking the equivalence of the parameter types of the conversion operator (since same_type_p considers these two declarations equivalent). I think probably what should happen here is that the ABI tag applied to the instantiation of '__shared_ptr' should not inherently propagate to template friend declarations. Either that or we should (also?) improve the modules deduping logic of RECORD_TYPEs to handle this case better.