https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112089
Bug ID: 112089 Summary: std::shared_lock::unlock should throw operation_not_permitted instead resource_deadlock_would_occur Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: d at ilvokhin dot com Target Milestone: --- Based on C++ standard wording, when we call unlock and don't own anything we should throw operation_not_permitted. Sec 33.6.5.5.3 from here (https://eel.is/c++draft/thread.lock.shared.locking#25.1): > void unlock(); > <...> > Error conditions: > operation_not_permitted — if on entry owns is false. But current implementation throws resource_deadlock_would_occur instead: https://github.com/gcc-mirror/gcc/blob/458db9b6149b2e9bef94ab76909eb914ed9f675a/libstdc%2B%2B-v3/include/std/shared_mutex#L823 It doesn't change much, just a little inconsistency.