https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106825
--- Comment #1 from Mark Millard <markmigm at gmail dot com> --- (In reply to Mark Millard from comment #0) FYI: I also see this on FreeBSD via the lang/gcc12 port (that, in my installed context, is at 12.2.0), using the default library: libstdc++ . I do not see any failure on FreeBSD when I use -stdlib=libc++ on the two command lines: # g++12 -std=c++20 -stdlib=libc++ -pedantic -Wall -Wextra -fmodules-ts -fPIC -xc++-system-header memory # g++12 -std=c++20 -stdlib=libc++ -pedantic -Wall -Wextra -fmodules-ts -fPIC -omodule_shared_ptr_failure module_shared_ptr_failure.cpp #