Abstract class `CommandLineFlag` has non-virtual destructor
- Linguagem predominante
- C++
- Estrelas
- 18.1k
- Forks
- 3.2k
- Merge médio
- 20h 36min
- PRs com merge (30d)
- 1
Descrição
The destructor of the class `CommandLineFlag` is missing the keyword `virtual` although this class has lots of pure virtual methods defining an interface. While this is generally a bad idea, this also results in compiler warnings if compiling the [webrtc-audio-processing](https://gitlab.freedesktop.org/pulseaudio/webrtc-audio-processing) library (version 1.0) for instance.
The following is what GCC is complaining:
```
In file included from /usr/include/absl/flags/internal/flag.h:35,
from /usr/include/absl/flags/flag.h:39,
from ../webrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_tool.cc:15:
/usr/include/absl/flags/commandlineflag.h:62:7: warning: ‘class absl::debian1::CommandLineFlag’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
In file included from /usr/include/absl/flags/flag.h:39,
from ../webrtc/modules/audio_processing/agc2/rnn_vad/rnn_vad_tool.cc:15:
/usr/include/absl/flags/internal/flag.h:440:7: warning: base class ‘class absl::debian1::CommandLineFlag’ has accessible non-virtual destructor [-Wnon-virtual-dtor]
```
This bug can trivially be solved like that:
``` patch
--- a/absl/flags/commandlineflag.h
+++ b/absl/flags/commandlineflag.h
@@ -153,7 +153,7 @@
bool ParseFrom(absl::string_view value, std::string* error);
protected:
- ~CommandLineFlag() = default;
+ virtual ~CommandLineFlag() = default;
private:
friend class flags_internal::PrivateHandleAccessor;
```
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.