https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87514
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #0) > In the __shared_ptr(_Sp_make_shared_tag ...) constructor we know the dynamic > type of *_M_refcount._M_pi is definitely _Sp_counted_ptr_inplace and so > could theoretically avoid the dynamic dispatch. > > This would require breaking encapsulation to allow __shared_ptr to access > the private __shared_count::_M_pi member. Is it worth it? If we're going to do that, we might as well avoid the _M_get_deleter kluge entirely. We could just directly access _M_refcount._M_pi->_M_ptr() to get the pointer out, instead of using the _M_get_deleter override as a backchannel.