https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105803
--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Reduced: namespace std { template <typename> class shared_ptr; } struct S {}; template <int> void build_matrices() { std::shared_ptr<S>(new S); }