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

Compiler chokes on dataflow overload with launch policy #776

Closed
mariomulansky opened this issue May 29, 2013 · 8 comments
Closed

Compiler chokes on dataflow overload with launch policy #776

mariomulansky opened this issue May 29, 2013 · 8 comments

Comments

@mariomulansky
Copy link
Contributor

i tried using the new launch policy feature of local dataflows, but gcc doesnt like the additional overload. If I write:

f1 = hpx::lcos::local::dataflow( hpx::launch::sync , unwrap(mul()) , f1 , f2 );

the compiler tries to instantiate the dataflow with 3 arguments using the launch policy as functor, which obviously fails. Specifically providing the template parameters works:

f1 = hpx::lcos::local::dataflow<hpx::util::detail::unwrap_impl<mul>, future_type& , future_type& >( 
    hpx::launch::sync , unwrap(mul()) , f1 , f2 );
@ghost ghost assigned sithhell May 29, 2013
@hkaiser
Copy link
Member

hkaiser commented May 30, 2013

Is this still a problem after the latest changes?

@mariomulansky
Copy link
Contributor Author

yes, compilation still fails on gcc 4.7.1

@hkaiser
Copy link
Member

hkaiser commented May 30, 2013

I'm almost certain that this is a compiler problem. Have you tried other compilers?

@mariomulansky
Copy link
Contributor Author

clang 3.1 reports the same problem, though with a much more readable error message:

/home/mario/hpx/include/hpx/lcos/local/preprocessed/dataflow_10.hpp:532:20: error: no type named 'type' in
      'boost::result_of<hpx::launch (hpx::util::detail::unwrap_impl<mul>, hpx::lcos::future<double>, hpx::lcos::future<double>)>'
                >::type
                ~~~^~~~
/home/mario/hpx/include/hpx/lcos/local/preprocessed/dataflow_10.hpp:727:22: note: in instantiation of template class
      'hpx::lcos::local::detail::dataflow_frame_3<hpx::launch, hpx::util::detail::unwrap_impl<mul>, hpx::lcos::future<double> &,
      hpx::lcos::future<double> &>' requested here
    typename detail::dataflow_frame_3<
                     ^
/home/mario/hpx/include/hpx/lcos/local/preprocessed/dataflow_10.hpp:731:5: note: while substituting deduced template arguments into
      function template 'dataflow' [with Func = hpx::launch, F0 = <no value>, F1 = , F2 = <no value>]
    dataflow(BOOST_FWD_REF(Func) func, BOOST_FWD_REF(F0) f0 , BOOST_FWD_REF(F1) f1 , BOOST_FWD_REF(F2) f2)

I think this indeed is a bug because template substitution works with hpx::launch interpreted as Func, but only then the error occurs when trying to obtain the result_of. Maybe there should be a disable_if< is_same< Func , hpx::launch> > added?

@sithhell
Copy link
Member

You are right, the overloads without a launch policy need to be disabled when Func is not a callable.

@sithhell
Copy link
Member

The reason why it works with MSVC is because it is very lazy with template instantiations.

@mariomulansky
Copy link
Contributor Author

i don't quite understand why the internal forward is working, though (when dataflow is called without a specific policy).

@sithhell
Copy link
Member

Someone removed the internal forwarding.

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