Boost logo

Boost :

Subject: Re: [boost] [utility]result_of - erroneous result type from a C++11 lambda
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-04-02 13:35:23


On Tuesday 02 April 2013 19:16:21 Vicente J. Botet Escriba wrote:
> 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?

I think this is because result_of is based on decltype for clang and TR1
protocol for gcc. This is because gcc doesn't support N3276. 4.8.0 release
notes state that it is supported but I saw someone on the list found some bug
in it so the support is incomplete for now.


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