When I run the CppCoreCheck code analysis on my VS2015 project, I get a number of warnings which seem "unfixable" because they refer to the underlying C++ implementation of classes and vtables:
An example class:
// Header file
class IMyClass {
public:
virtual ~IMyClass() {}
virtual void MyMethod() = 0;
};
class MyClass : public virtual IMyClass {
public:
MyClass();
virtual ~MyClass();
virtual void MyMethod() override;
};
// Impl file
MyClass::MyClass() { } // This line creates two warnings from CppCoreCheck
MyClass::~MyClass() { }
void MyClass::MyMethod() { }
And the warnings:
warning C26485: Expression 'MyClass::`vbtable'': No array to pointer decay. (bounds.3: http://go.microsoft.com/fwlink/p/?LinkID=620415)
warning C26481: Don't use pointer arithmetic. Use span instead. (bounds.1: http://go.microsoft.com/fwlink/p/?LinkID=620413)
The line which the warning is complaining about references the constructor definition for MyClass
For clarity; I am not directly referencing the vtable anywhere in my code; I'm simply using virtual inheritance in a 100% typical fashion.
Can someone confirm if this is a bug specific to VS2015's implementation of the CppCoreCheck? If so, is it resolved in VS2017?
This is a known issue in VS2015 which will not be fixed. It is resolved as of VS2017, v15.5.