https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105734
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- A little more reduced: namespace hh { struct nothing {}; template<int = 1> struct s { s h(); }; } template <int> void bar() { auto m = hh::s(hh::s{}.h()); m.~s(); } void foo() { bar<1>(); } The template arguments can be the same even.