Can I override a CUDA host-and-device function with a host-only function?
问题 Consider the following program: class A { __host__ __device__ void foo(); }; class B : A { __host__ void foo(); }; int main() { A a; (void) a; B b; (void) b; } This compiles (GodBolt) with nvcc 10. Yet, in more complex programs, I sometimes get the following error (line breaks for readability): whatever.hpp(88): error: execution space mismatch: overridden entity (function "C::foo") is a __host__ __device__ function, but overriding entity (function "D::foo") is a __host__ function So, nvcc is