Opened 8 years ago

Closed 8 years ago

#10963 closed Bugs (fixed)

future<future<T>>::then Has No Implementation

Reported by: code@… Owned by: viboes
Milestone: Boost 1.58.0 Component: thread
Version: Boost 1.57.0 Severity: Problem
Keywords: Cc:

Description

Linker errors when using .then() on a future<future<T>>

Undefined symbols for architecture x86_64:
  "boost::future<boost::result_of<TestCallback (boost::future<boost::future<void> >)>::type> boost::future<boost::future<void> >::then<TestCallback>(TestCallback&&)", referenced from:
      _main in test_100000.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Example:

struct TestCallback
{
    typedef boost::future<void> result_type;

    result_type operator()(boost::future<void> future) const
    {
        future.get();
        return boost::make_ready_future();
    }

    result_type operator()(boost::future<boost::future<void>> future) const
    {
       future.get();
       return boost::make_ready_future();
    }
};

int main()
{
    boost::promise<void> test_promise;
    boost::future<void> test_future(test_promise.get_future());
    test_future.then(TestCallback()).then(TestCallback());
    return 0;
}

Change History (4)

comment:1 by viboes, 8 years ago

Owner: changed from Anthony Williams to viboes
Status: newassigned

This is weird. The result of

test_future.then(TestCallback())

should be future<void> and so future<future<void>::then will not necessary in this case.

I'm not saying that there is no problem. I will add the test and check it.

Last edited 8 years ago by viboes (previous) (diff)

comment:2 by viboes, 8 years ago

Hrr, I have not implemented yet the implicit unwrap when calling future::then.

Note: See TracTickets for help on using tickets.