https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125565

Tomasz Kamiński <tkaminsk at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkaminsk at gcc dot gnu.org

--- Comment #1 from Tomasz Kamiński <tkaminsk at gcc dot gnu.org> ---
> Feels like calling _M_weak_this.reset() before calling the deleter would be a 
> straightforward fix.

As you observed, this is observable for by the user (if the weak_ptr) are
reused, so
clearing weak_ptr would be non-conforming per strict reading of the standard.
We explicitly mention the constructor setting the standard
(https://eel.is/c++draft/util.sharedptr#util.smartptr.shared.const-1), but
there is no such operation in destructor.

This is why all standard libraries agree on current behavior:
https://godbolt.org/z/9nefhhEjv.

Changing the above, would require changing the standard.

Reply via email to