Skip to content

Commit 5178142

Browse files
committed
NthItemTest: Add definition for virtual destructor
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 <[email protected]>
1 parent 80c1235 commit 5178142

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

unittest/nthitem_test.cc

+6
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ int test_data[] = { 8, 1, 2, -4, 7, 9, 65536, 4, 9, 0, -32767, 6, 7};
2121
// The fixture for testing GenericHeap and DoublePtr.
2222
class NthItemTest : public testing::Test {
2323
public:
24+
virtual ~NthItemTest();
2425
// Pushes the test data onto the KDVector.
2526
void PushTestData(KDVector* v) {
2627
for (int i = 0; i < ARRAYSIZE(test_data); ++i) {
@@ -30,6 +31,11 @@ class NthItemTest : public testing::Test {
3031
}
3132
};
3233

34+
// Destructor.
35+
// It is defined here, so the compiler can create a single vtable
36+
// instead of a weak vtable (fixes compiler warning).
37+
NthItemTest::~NthItemTest() = default;
38+
3339
// Tests basic results.
3440
TEST_F(NthItemTest, GeneralTest) {
3541
KDVector v;

0 commit comments

Comments
 (0)