Skip to content
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

RxSO3Base operator= should use quaternion_nonconst() instead of quaternion() #132

Closed
nburrus opened this issue Jan 17, 2018 · 2 comments
Closed

Comments

@nburrus
Copy link

nburrus commented Jan 17, 2018

Below is the patch I applied (sorry for inlining it since it's just one line and I have not forked the project). In short, we can't assign using quaternion() since it's const. I've just changed it to quaternion_nonconst().

diff --git a/sophus/rxso3.hpp b/sophus/rxso3.hpp
index 463d1ae..d94bfc8 100644
--- a/sophus/rxso3.hpp
+++ b/sophus/rxso3.hpp
@@ -197,7 +197,7 @@ class RxSO3Base {
   template <class OtherDerived>
   SOPHUS_FUNC RxSO3Base<Derived>& operator=(
       RxSO3Base<OtherDerived> const& other) {
-    quaternion() = other.quaternion();
+    quaternion_nonconst() = other.quaternion();
     return *this;
   }
@strasdat
Copy link
Owner

I thought I had unit test coverage for this but this bug is more subtle than it seems. In particular, this assignment-like operator is almost never called, since the default assignment operator was still generated by the compiler.

@strasdat
Copy link
Owner

Solved in PR #136.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants