Skip to content

Commit

Permalink
NthItemTest: Add definition for virtual destructor
Browse files Browse the repository at this point in the history
This fixes a compiler warning from clang:

unittest/nthitem_test.cc:22:7: warning:
 'NthItemTest' has no out-of-line virtual method definitions;
 its vtable will be emitted in every translation unit [-Wweak-vtables]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Sep 4, 2018
1 parent 80c1235 commit 5178142
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions unittest/nthitem_test.cc
Expand Up @@ -21,6 +21,7 @@ int test_data[] = { 8, 1, 2, -4, 7, 9, 65536, 4, 9, 0, -32767, 6, 7};
// The fixture for testing GenericHeap and DoublePtr.
class NthItemTest : public testing::Test {
public:
virtual ~NthItemTest();
// Pushes the test data onto the KDVector.
void PushTestData(KDVector* v) {
for (int i = 0; i < ARRAYSIZE(test_data); ++i) {
Expand All @@ -30,6 +31,11 @@ class NthItemTest : public testing::Test {
}
};

// Destructor.
// It is defined here, so the compiler can create a single vtable
// instead of a weak vtable (fixes compiler warning).
NthItemTest::~NthItemTest() = default;

// Tests basic results.
TEST_F(NthItemTest, GeneralTest) {
KDVector v;
Expand Down

0 comments on commit 5178142

Please sign in to comment.