[Bug c++/52988] std::async not executed on function returning nullptr_t

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Apr 14 17:40:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52988

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-04-14 17:40:18 UTC ---
Slightly reduced testcase without <iostream>

#include <future>

using namespace std;

nullptr_t returns_nullptr_t()
{
        __builtin_puts("returns_nullptr_t");
        return nullptr;
}

int returns_int()
{
        __builtin_puts("returns_int");
        return 22;
}

int main()
{
        future<nullptr_t> fnp = async(returns_nullptr_t);
        //fnp.wait();   // The workaround.
        fnp.get();

        future<int> fi = async(returns_int);
        fi.get();

    return 0;
}



More information about the Gcc-bugs mailing list