From e337f249338e05d5f67d6b8ff5d9c0a4a32f0693 Mon Sep 17 00:00:00 2001 From: Ramon Wijnands Date: Thu, 7 Dec 2023 14:41:29 +0100 Subject: [PATCH] Fix destructors should be public virtual I encountered some compilation errors with clang. It complains that the destructor is not virtual. According to the cpp core guidelines a destructor should be either public and virtual or protected and non virtual. See also this link: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c35-a-base-class-destructor-should-be-either-public-and-virtual-or-protected-and-non-virtual --- include/robot_state_publisher/joint_state_listener.h | 2 +- include/robot_state_publisher/robot_state_publisher.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/robot_state_publisher/joint_state_listener.h b/include/robot_state_publisher/joint_state_listener.h index ee03951..44087d5 100644 --- a/include/robot_state_publisher/joint_state_listener.h +++ b/include/robot_state_publisher/joint_state_listener.h @@ -69,7 +69,7 @@ class JointStateListener { /// Destructor - ~JointStateListener(); + virtual ~JointStateListener(); private: std::string getTFPrefix(); diff --git a/include/robot_state_publisher/robot_state_publisher.h b/include/robot_state_publisher/robot_state_publisher.h index 2a7b30e..1475953 100644 --- a/include/robot_state_publisher/robot_state_publisher.h +++ b/include/robot_state_publisher/robot_state_publisher.h @@ -74,7 +74,7 @@ class RobotStatePublisher RobotStatePublisher(const KDL::Tree& tree, const urdf::Model& model = urdf::Model()); /// Destructor - ~RobotStatePublisher(){}; + virtual ~RobotStatePublisher() = default; /** Publish transforms to tf * \param joint_positions A map of joint names and joint positions.