Skip to content

Commit 94d227b

Browse files
committed
IndexMapBiDi: Define virtual destructor in .cpp file
This fixes compiler warnings from clang: src/ccutil/indexmapbidi.h:102:7: warning: 'IndexMapBiDi' 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 319de30 commit 94d227b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/ccutil/indexmapbidi.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ bool IndexMap::DeSerialize(bool swap, FILE* fp) {
6262
return compact_map_.DeSerialize(swap, fp);
6363
}
6464

65+
// Destructor.
66+
// It is defined here, so the compiler can create a single vtable
67+
// instead of weak vtables in every compilation unit.
68+
IndexMapBiDi::~IndexMapBiDi() = default;
6569

6670
// Top-level init function in a single call to initialize a map to select
6771
// a single contiguous subrange [start, end) of the sparse space to be mapped

src/ccutil/indexmapbidi.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class IndexMap {
101101
// Allows a many-to-one mapping by merging compact space indices.
102102
class IndexMapBiDi : public IndexMap {
103103
public:
104-
virtual ~IndexMapBiDi() {}
104+
virtual ~IndexMapBiDi();
105105

106106
// Top-level init function in a single call to initialize a map to select
107107
// a single contiguous subrange [start, end) of the sparse space to be mapped

0 commit comments

Comments
 (0)