geometry2
geometry2 copied to clipboard
Non-virtual destructor in tf2_ros::BufferInterface
When compiling against tf2_ros with -Wnon-virtual-dtor
we get the following warning:
In file included from /opt/ros/indigo/include/tf2_ros/buffer.h:35:0,
from
... < snipped private file names > ...
/opt/ros/indigo/include/tf2_ros/buffer_interface.h:47:7: warning: ‘class tf2_ros::BufferInterface’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
class BufferInterface
Stumbled upon this in some research work. I suspect this is only an issue if a virtual class has some data members (https://stackoverflow.com/questions/7403883/derived-class-with-non-virtual-destructor). The warning may be spurious for interfaces with no data members. Probably safe to close this.
Alternatively, adding
virtual ~base() = default;
should do the job, which would have the effect of forcing sub-classes to have a virtual destructor (so apparently a bit safer than ignoring)