Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async does not work for member function pointers when called on types with self-defined unary operator* #1179

Closed
eschnett opened this issue Jul 4, 2014 · 1 comment

Comments

@eschnett
Copy link
Contributor

eschnett commented Jul 4, 2014

In the code below, the function g uses the STL, while the function h uses HPX. g compiles fine, but h does not. This is with Clang 3.4.2, using GCC 4.9.0's STL, and using Boost 1.55, running on OS X.

#include <future>
#include <hpx/hpx.hpp>

struct s {
  int f() const;
};

struct p {
  s *x;
  s &operator*() const { return *x; }
};

std::future<int> g(p x) { return std::async(&s::f, x); }

hpx::future<int> h(p x) { return hpx::async(&s::f, x); }

The relevant part of the error message is

async.cc:15:34: error: no matching function for call to 'async'
hpx::future<int> h(p x) { return hpx::async(&s::f, x); }

/Users/eschnett/SIMFACTORY/hpx-master/install/include/hpx/preprocessed/async_5.hpp:148:5: note: 
      candidate template ignored: substitution failure [with F = int (s::*)()
      const, A0 = p &]: no type named 'type' in 'boost::lazy_enable_if_c<false,
      hpx::detail::create_future<int (s::*(p &))() const, int> >'
    async(F && f, A0 && a0)
    ^

The respective async declaration in HPX is:

    template <typename F, typename A0>
    typename boost::lazy_enable_if_c<
        traits::detail::is_callable_not_action<
            typename util::decay<F>::type(
                typename util::decay<A0>::type)>::value
     && !traits::is_bound_action<typename util::decay<F>::type>::value
      , detail::create_future<F(A0)>
    >::type
    async(F && f, A0 && a0)

It appears that traits::detail::is_callable_not_action is returning false, which is wrong.

@K-ballo K-ballo self-assigned this Jul 4, 2014
@hkaiser hkaiser added this to the 0.9.9 milestone Jul 4, 2014
K-ballo added a commit to K-ballo/hpx that referenced this issue Jul 4, 2014
K-ballo added a commit to K-ballo/hpx that referenced this issue Jul 4, 2014
@K-ballo
Copy link
Member

K-ballo commented Jul 5, 2014

Fixed by cd3a2e2

@K-ballo K-ballo closed this as completed Jul 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants