https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106820
Mark Millard <markmigm at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|internal compiler error: in |internal compiler error: in |function_and_variable_visib |function_and_variable_visib |ility [for |ility [for |std::dynamic_pointer_cast |std::shared_ptr<data>{b,??} |use via <memory> module] |use via <memory> module] --- Comment #2 from Mark Millard <markmigm at gmail dot com> --- I've produced a more reduced example source: import <memory>; struct data { virtual ~data() = default; }; auto test(std::shared_ptr<data> b) { return std::shared_ptr<data>{b,nullptr}; } nullptr is not special here: other alternative raw pointers also get the "internal compiler error: in function_and_variable_visibility" notice. nullptr is just the simplest example. Using a #include instead also gets the error (as expected) --unless the -fmodules-ts command line option is then omitted. -fmodules-ts is important to getting the message in the FreeBSD lang/gcc12 context.