I was under the impression that the promise object itself has to be alive when the future result is used. and since you're emptying your queue on execution it's not.
but considering that the promise object could be in another thread that was probably a false impression.
Which compiler does this even work with yet? Both gcc and clang fail. clang on compilation, gcc compiles it but fails at runtime with a system_error exception and an invalid error code.
so you might wanna consider compiler and library bugs, too.