IsVirtual for destructors


I’ve read the source code of the CXXMethodDecl::isVirtual function

bool isVirtual() const {

CXXMethodDecl *CD =


// Member function is virtual if it is marked explicitly so, or if it is

// declared in __interface – then it is automatically pure virtual.

if (CD->isVirtualAsWritten() || CD->isPure())

return true;

return (CD->begin_overridden_methods() != CD->end_overridden_methods());


In code such as the following:

struct Base


virtual ~Base();


struct Derived :Base




The derived class destructor is virtual, but it is not virtual as written, not pure, and it appears that the list of overridden methods is empty. So the isVirtual function returns false.

Shall I fill a bug report?

Oops, sorry, I posted too fast, my test case had another issue. Please ignore my previous message.