17
Is this code valid, or is my compiler broken?
#include <future>
#include <iostream>
int main() {
std::cout << "doing the test" << std::endl;
std::promise<bool> mypromise;
std::future<bool> myfuture = mypromise.get_future();
mypromise.set_value(true);
bool result = myfuture.get();
std::cout << "success, result is " << result << std::endl;
return 0;
}
Here's the output:
$ g++-mp-4.8 -std=c++11 test.cpp
$ ./a.out
doing the test
Segmentation fault: 11
$
I'm using g++-mp-4.8, which is the gcc 4.8 from macports.
Am I going insane?