https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108118
Bug ID: 108118
Summary: std::weak_ptr lacks a self-usurp check on move
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: b.stanimirov at abv dot bg
Target Milestone: ---
If one somehow move-assigns a weak pointer to itself, it gets destroyed.
Demo: https://godbolt.org/z/eWdhYMhYe
