id summary reporter owner description type status milestone component version severity resolution keywords cc 13513 Nvidia cuda compiler 9 does not work with boost::mp11 Alexander Matthes "I am working with cuda and I choose to use boost::mp11 for my projects. However cuda 9 does not work with boost::mp11, even this simple application fails: {{{ #include int main() {} }}} To be fair, this seems to be a bug in the nvidia compiler not boost, but this is a showstopper for using boost::mp11 together with a recent cuda version. Everything works fine with cuda 8. I already figured out, what fails in the background in the nvcc (details are [https://github.com/ComputationalRadiationPhysics/alpaka/issues/459#issuecomment-377678240 here]), but now also found a work around for boost::mp11: The problem occurs on code like this: {{{ template class F, class... T> using mp_defer = mp_if, detail::mp_defer_impl, detail::mp_no_type>; }}} Everytime mp_if is used, the nvcc preprocessor tries to be ""smart"" and starts recursively replacing stuff so that in the end detail::mp_no_type... is given to the compiler. I figured out I can prevent nvcc from doing this with invoking another struct inbetween like this: {{{ template class F, class... T> struct cuda_workaround { using type = mp_if, detail::mp_defer_impl, detail::mp_no_type>; }; template class F, class... T> using mp_defer = typename cuda_workaround< F, T... >::type; }}} This work around is needed on 5 places in the boost mp11: * mp_append.hpp {{{ template struct mp_append_impl: mp_if_c<(sizeof...(L) > 111), mp_quote, mp_if_c<(sizeof...(L) > 11), mp_quote, mp_quote > >::template fn }}} * algorithm.hpp {{{ template class F, class... L> using mp_transform = typename mp_if...>, detail::mp_transform_impl, detail::list_size_mismatch>::type; }}} {{{ template using mp_at_c = typename mp_if_c<(I < mp_size::value), detail::mp_at_c_impl, void>::type; }}} {{{ using type = typename mp_cond< mp_bool<(I < N1)>, mp_nth_element_impl, mp_bool<(I == N1)>, mp_identity, mp_true, mp_nth_element_impl >::type; }}} * utility.hpp {{{ template class F, class... T> using mp_defer = mp_if, detail::mp_defer_impl, detail::mp_no_type>; }}} I added an intermediate struct as seen above for every case if cuda 9 is used and now my code compiles with nvcc 9. So I suggest to add such a work around for cuda 9 and above. I can also do this myself, what would be the best way? Providing a patch for the most recent version on github or directly opening a pull request?" Bugs closed To Be Determined None Boost 1.66.0 Showstopper obsolete