Search code examples
c++boostcudanvcc

compilation error with nvcc and BOOST library


nvcc throws

/usr/include/boost/concept/detail/has_constraints.hpp:29: error: ‘&’ cannot appear in a constant-expression
/usr/include/boost/concept/detail/has_constraints.hpp:29: error: template argument 2 is invalid

the has_constraints.hpp already has some suspicious code in it:

#if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580)
  // Work around the following bogus error in Sun Studio 11, by
  // turning off the has_constraints function entirely:
  //    Error: complex expression not allowed in dependent template
  //    argument expression
  inline no has_constraints_(...);
#else
  template <class Model>
  inline yes has_constraints_(Model*, wrap_constraints<Model,&Model::constraints>* = 0);
  inline no has_constraints_(...);
#endif

Question: Is this a nvcc - boost incompatibility, or could there be something wrong with my code?


Solution

  • What we did at the end was to turn has_constraints_ off as in the example quoted in the question for Sun Studio 11