From 2ef0a97995f86551ae2a4d06e2b122e507a38e48 Mon Sep 17 00:00:00 2001 From: AlexBeattie42 <30098201+alexbeattie42@users.noreply.github.com> Date: Tue, 14 Oct 2025 13:34:23 +0300 Subject: [PATCH 1/2] Fix ControlLinearNode Overshadowing --- OpenSim/Simulation/Control/ControlLinearNode.cpp | 12 +++++++----- OpenSim/Simulation/Control/ControlLinearNode.h | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/OpenSim/Simulation/Control/ControlLinearNode.cpp b/OpenSim/Simulation/Control/ControlLinearNode.cpp index 9f6a701a47..77a657eda2 100644 --- a/OpenSim/Simulation/Control/ControlLinearNode.cpp +++ b/OpenSim/Simulation/Control/ControlLinearNode.cpp @@ -141,10 +141,11 @@ operator=(const ControlLinearNode &aNode) * @return True if the times are equal, false otherwise. */ bool ControlLinearNode:: -operator==(const ControlLinearNode &aNode) const +operator==(const Object &aNode) const { - if((_t) > aNode._t) return(false); - if((_t) < aNode._t) return(false); + const ControlLinearNode& node = static_cast(aNode); + if((_t) > node._t) return(false); + if((_t) < node._t) return(false); return(true); } @@ -159,9 +160,10 @@ operator==(const ControlLinearNode &aNode) const * @return True if the time of this node is less than the time of aNode. */ bool ControlLinearNode:: -operator<(const ControlLinearNode &aNode) const +operator<(const Object &aNode) const { - if(_t(aNode); + if(node._t) return(true); else return(false); } diff --git a/OpenSim/Simulation/Control/ControlLinearNode.h b/OpenSim/Simulation/Control/ControlLinearNode.h index 117ddff650..5cc8eb6313 100644 --- a/OpenSim/Simulation/Control/ControlLinearNode.h +++ b/OpenSim/Simulation/Control/ControlLinearNode.h @@ -92,8 +92,8 @@ OpenSim_DECLARE_CONCRETE_OBJECT(ControlLinearNode, Object); public: #ifndef SWIG ControlLinearNode& operator=(const ControlLinearNode &aControl); - bool operator==(const ControlLinearNode &aControl) const; - bool operator<(const ControlLinearNode &aControl) const; + bool operator==(const Object &aControl) const override; + bool operator<(const Object &aControl) const override; friend std::ostream& operator<<(std::ostream &aOut, const ControlLinearNode &aControlLinearNode); From b1d715bb650abd22f28d65b463c74c4668ae850d Mon Sep 17 00:00:00 2001 From: AlexBeattie42 <30098201+alexbeattie42@users.noreply.github.com> Date: Tue, 14 Oct 2025 15:25:25 +0300 Subject: [PATCH 2/2] Update to use dynamic cast --- OpenSim/Simulation/Control/ControlLinearNode.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Simulation/Control/ControlLinearNode.cpp b/OpenSim/Simulation/Control/ControlLinearNode.cpp index 77a657eda2..e04d0187c8 100644 --- a/OpenSim/Simulation/Control/ControlLinearNode.cpp +++ b/OpenSim/Simulation/Control/ControlLinearNode.cpp @@ -143,7 +143,7 @@ operator=(const ControlLinearNode &aNode) bool ControlLinearNode:: operator==(const Object &aNode) const { - const ControlLinearNode& node = static_cast(aNode); + const auto& node = dynamic_cast(aNode); if((_t) > node._t) return(false); if((_t) < node._t) return(false); return(true); @@ -162,7 +162,7 @@ operator==(const Object &aNode) const bool ControlLinearNode:: operator<(const Object &aNode) const { - const ControlLinearNode& node = static_cast(aNode); + const auto& node = dynamic_cast(aNode); if(node._t) return(true); else return(false); }