-
Notifications
You must be signed in to change notification settings - Fork 343
Fix ControlLinearNode Overshadowing #4096
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix ControlLinearNode Overshadowing #4096
Conversation
@nickbianco is this a suitable fix for the compiler warning? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alexbeattie42 let's try overriding Object
's virtual methods to see if that resolves the compiler warnings.
Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @alexbeattie42)
OpenSim/Simulation/Control/ControlLinearNode.h
line 99 at r1 (raw file):
ControlLinearNode& operator=(const ControlLinearNode &aControl); bool operator==(const ControlLinearNode &aControl) const; bool operator<(const ControlLinearNode &aControl) const;
I think we should only need to add override
calls to Object
s virtual methods. We should be able to leave the copy assignment operator for ControlLinearNode
as-is since it not a virtual method of Object
.
Suggestion:
ControlLinearNode& operator=(const ControlLinearNode &aControl);
bool operator==(const ControlLinearNode &aControl) const override;
bool operator<(const ControlLinearNode &aControl) const override;
1fd7b72
to
2b7796e
Compare
Previously, nickbianco (Nick Bianco) wrote…
If I make this change clang complains that: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried the suggested approach and clang is not happy with it sadly.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @nickbianco)
Ah, that is because the signatures are different. To truly satisfy bool operator==(const Object& other) const override;
bool operator<(const Object& other) const override; This is an odd quirk of polymorphism that I hadn't considered before. I suppose you could do that, but then you would need to |
Fixes issue #4095
Brief summary of changes
Testing I've completed
Looking for feedback on...
CHANGELOG.md (choose one)
This change is