diff options
author | Guillaume Maudoux <guillaume.maudoux@tweag.io> | 2023-01-24 16:37:50 +0100 |
---|---|---|
committer | Guillaume Maudoux <guillaume.maudoux@tweag.io> | 2023-01-24 16:37:50 +0100 |
commit | 734c5fdcd62ead1b28e7f7fa3962ce0b542d5846 (patch) | |
tree | 53b42f267299b79aea07b3b3aaada574bfa9616f /src/libutil/error.hh | |
parent | f233fd496db07212125696613ac085506e2be805 (diff) |
Fix 'destructor called on non-final ...' warning
clangStdenv compiles with a single warning:
```
warning: destructor called on non-final 'nix::PosAdapter' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
```
This fixes the warning by making the destructor of PosAdapter virtual,
deffering to the correct destructor from the concrete child classes.
This has no impact in the end, as none of these classes have specific
destructors.
Technicaly, it may be faster not to have this indirection, but as per
the warning, there is only one place where we have to delete abstract
PosAdapter values.
Not worth bikesheding I guess.
Diffstat (limited to 'src/libutil/error.hh')
-rw-r--r-- | src/libutil/error.hh | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libutil/error.hh b/src/libutil/error.hh index 7d236028c..0ebeaba61 100644 --- a/src/libutil/error.hh +++ b/src/libutil/error.hh @@ -74,6 +74,8 @@ struct AbstractPos virtual void print(std::ostream & out) const = 0; std::optional<LinesOfCode> getCodeLines() const; + + virtual ~AbstractPos() = default; }; std::ostream & operator << (std::ostream & str, const AbstractPos & pos); |