According to the Concurrency TS, what should happen in the following code?
auto f0 = std::async([]{return 0;});
auto f1 = f0.then([](auto& f){ return f.get() + 10; });
auto f2 = f0.then([](auto& f){ if(!f.valid()) return; return f.get() + 10;});
By the time the third line of code is executed, f0
already has a continuation, so, according to the TS, should f0
throw an exception, abort the program, UB or has a different behaviour? It's unclear to me.
According to cppreference, it is undefined: