https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60966
--- Comment #21 from Jonathan Wakely <redi at gcc dot gnu.org> --- Created attachment 32801 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32801&action=edit increase reference count on shared state during set_value / set_exception This patch ensures the shared state will not be destroyed even if ~promise() starts before the return from set_value. It also moves the condition variables broadcast later, so that waiting threads are not signalled until right before returning.