Skip to content

Handle __declspec(novtable) #276

@sei-eschwartz

Description

@sei-eschwartz

In #275, we learned that certain ATL interface classes use __declspec(novtable) which stops the compiler from installing vftables. This causes problems with reasonNOTConstructor_G, and probably other rules as well.

This can be observed in https://github.com/edmcman/MFCApplication/blob/master/Release/MFCApplication.exe at CView::CView which does not install a vftable.

How should we fix this? One option might be to hard-code a list of classes to block for reasonNOTConstructor_G. For example, in #275, that would be CScrollView. CScrollView does have a vftable, but its parent, CView, does not. We can use RTTI to identify the installation of CScrollView's vftable, and from there block it.

But this only works because CScrollView does not have __declspec(novtable). It definitely could though, as it is an abstract class. So this technique might not work universally.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions