Microsoft VS2015 C++ Core Guidelines 解析:"no array to pointer decay (bounds.3)" for vtable?

Microsoft VS2015 C++ Core Guidelines Analysis: "no array to pointer decay (bounds.3)" for vtable?

当我 运行 对我的 VS2015 项目进行 CppCoreCheck 代码分析时,我收到了一些警告,这些警告看起来 "unfixable" 因为它们指的是 classes 的底层 C++ 实现和虚拟表:

一个例子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() { }

以及警告:

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)

警告所抱怨的行引用了 MyClass

的构造函数定义

为清楚起见;我没有在代码中的任何地方直接引用 vtable;我只是以 100% 典型的方式使用虚拟继承。

有人可以确认这是否是针对 VS2015 的 CppCoreCheck 实现的错误吗?如果是,是否在 VS2017 中解决了?

这是 VS2015 中的一个已知问题,不会修复。是resolved as of VS2017, v15.5.