It appears that nvfunctional
has logic that has not been updated to allow c++20 in all cases.
Specifically, see this snippet from the file.
#elif defined(_MSC_VER)
// simulate VC 2013's behavior...
template <class _F>
struct __check_callability1
: public
std::integral_constant<bool,
// std::result_of does not handle member pointers well
std::is_member_pointer<_F>::value ||
std::is_convertible<
_RetType,
typename std::result_of<_F(_ArgTypes...)>::type
>::value
>
{ };
This results in an error pointing out that std
has no member result_of
as it has been removed in c++20.
Steps to reproduce:
CUDA: 12.4
OS: Windows
IDE: Visual Studio 2022 v17.9.4
- Create a new CUDA 12.4 Runtime project from the template of the same name.
- Ensure that the provided
kernel.cu
file is properly configured as a CUDA C/C++ file in visual studio (should be by default) - Replace the contents of
kernel.cu
with just the following
#include <nvfunctional>
int main()
{
return 0;
}
- Update to c++20 in the standard settings.
- Update to c++20 in the CUDA C/C++ settings by adding
--std c++20
to the Additional Options in CUDA C/C++ > Command Line. - Build
Note this this works fine if things are configured for c++17.