Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declare default virtual destructors to quiet [-Wnon-virtual-dtor] #405

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions tests/ComTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ IUnknownFake : public IUnknown
ReleaseCounter = 0;
return res;
}
virtual ~IUnknownFake() = default;
protected:
static int AddRefCounter;
static int ReleaseCounter;
Expand Down Expand Up @@ -552,6 +553,7 @@ class ExtensionHelper
{
return 0;
}
virtual ~ExtensionHelper() = default;
};

TEST_CASE("ComTests::Test_ConstPointer", "[com][com_ptr]")
Expand Down Expand Up @@ -597,6 +599,7 @@ TEST_CASE("ComTests::Test_ComPtrWithForwardDeclaration", "[com][com_ptr]")
{
return 0;
}
virtual ~MyClass() = default;
};
}

Expand All @@ -614,6 +617,7 @@ interface __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20a01"))
IDerivedTest : public ITest
{
STDMETHOD_(void, TestDerived)() = 0;
virtual ~ITest() = default;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ~IDerivedTest - you can't declare a destructor for a base type.

};

interface __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20a02"))
Expand All @@ -626,18 +630,21 @@ interface __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20a03"))
IDerivedTestInspectable : public ITestInspectable
{
STDMETHOD_(void, TestInspctableDerived)() = 0;
virtual ~ITestInspectable() = default;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above; s/b ~IDerivedTestInspectable

};

interface __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20a04"))
INever : public IUnknown
{
STDMETHOD_(void, Never)() = 0;
virtual ~INever() = default;
};

interface __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20a05"))
IAlways : public IUnknown
{
STDMETHOD_(void, Always)() = 0;
virtual ~IAlways() = default;
};

class __declspec(empty_bases) __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20b00")) // non-implemented to allow QI for the class to be attempted (and fail)
Expand Down Expand Up @@ -2574,6 +2581,7 @@ class FakeStream : public IStream
{
return SetPosition(position, position);
}
virtual ~FakeStream() = default;
};

TEST_CASE("StreamTests::ReadPartial", "[com][IStream]")
Expand Down
2 changes: 2 additions & 0 deletions tests/ResourceTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ interface __declspec(uuid("ececcc6a-5193-4d14-b38e-ed1460c20b00"))
ITest : public IUnknown
{
STDMETHOD_(void, Test)() = 0;
virtual ~ITest() = default;
};

class __declspec(empty_bases) PointerTestObject : witest::AllocatedObject,
Expand Down Expand Up @@ -810,6 +811,7 @@ TEST_CASE("UniqueInvokeCleanupMembers", "[resource]")
struct ITokenTester : IUnknown
{
virtual void DirectClose(DWORD_PTR token) = 0;
virtual ~ITokenTester() = default;
};

struct TokenTester : ITokenTester
Expand Down
Loading