I am on Visual Studio 2013 and is trying to compile a CUDA code that utilizes inheritance and C++11. The code below returns "modifier is not allowed on a destructor" error because of the "override".
// derived.cuh
class derived : public base
{
public:
derived();
~derived() override;
};
where the destructor of the base class is virtual. The exact same code compiles fine on Ubuntu. The exact same code also compiles fine with default Visual studio c++ compiler if I change the .cu and .cuh to .cpp and .h. C++11 is enabled because if the "override" is appended on a normal function it also compiles fine. See example below,
// derived2.cuh
class derived2 : public base
{
public:
derived2();
~derived2();
void func() override;
};
where func() is an virtual function in the base class.
How to get rid of the "modifier is not allowed on a destructor" error when compiled with nvcc in VS2013?
Filed this bug to NVIDIA, and they responded back that this will be fixed in the next CUDA release (presumably 8.0).