Boost logo

Boost :

Subject: [boost] [utility]result_of - erroneous result type from a C++11 lambda
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-04-02 13:16:21


Hi,

I've started to use C++11 lambda functions with Boost.Thread.

The following works with clang-3.2

boost::future<int> f1 = boost::async( []() -> int {return 123;} );

But it fails with gcc-4.6.2, 4.7.2 and 4.8.0

../example/lambda_future.cpp:25:91: erreur: conversion from
‘boost::future<void>’ to non-scalar type ‘boost::future<int>’ requested
boost::future<int> f1 = boost::async( []() -> int {return 123;} );

The current implementation of boost::async uses boost::result_of to get
the result type of the callable parameter.

Is this a know bug on boost::result_of or gcc compiler?

Best,
Vicente


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk