mercredi 10 février 2021

Crash in std::promise::set_value crash

error: terminate called after throwing an instance of 'std::future_error' what(): std::future_error: No associated state

g++ --version 7.5.0 however, the same lines of code runs fine on QNX with same g++ version.

#include <future>

using namespace std;

int main()
{
    promise<int> p1;
    promise<int> p2(move(p1));
    p1.set_value(99); // SIGSEGV!
}

Aucun commentaire:

Enregistrer un commentaire