我的机器上的std :: promise是否损坏(使用g ++-mp)? [英] Is std::promise broken on my machine (using g++-mp)?

查看:29
本文介绍了我的机器上的std :: promise是否损坏(使用g ++-mp)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此代码有效,还是我的编译器损坏了?

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;
}

这是输出:

$ g++-mp-4.8 -std=c++11 test.cpp
$ ./a.out
doing the test
Segmentation fault: 11
$ 

我正在使用g ++-mp-4.8,它是macports中的gcc 4.8.

I'm using g++-mp-4.8, which is the gcc 4.8 from macports.

我疯了吗?

推荐答案

这是MacPorts错误.MacPorts上已经有错误报告.您可以在此处关注

This is a MacPorts bug. There are already bug reports on MacPorts. You can follow there:

https://trac.macports.org/ticket/38814 (主要问题)
https://trac.macports.org/ticket/38833 (我的报告,当前标记为重复#38814)

https://trac.macports.org/ticket/38814 (main issue)
https://trac.macports.org/ticket/38833 (my report, currently marked as duplicate of #38814)

这篇关于我的机器上的std :: promise是否损坏(使用g ++-mp)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆