Use boost::declval instead of std::declval, close #10190.

Thanks-to: Niklas Angare