With g++ 5.4 and eigen 3.3.4 on ubuntu 16.04 const double d[4] = {0, 0, 0, 1}; Map<const Vector4d> v(d); double s = v.w(); // ok Map<const Quaterniond> q(d); double w = q.w(); // compile error /usr/local/include/eigen3/Eigen/src/Geometry/Quaternion.h:76:84: error: binding ‘const Scalar {aka const double}’ to reference of type ‘Eigen::QuaternionBase<Eigen::Map<const Eigen::Quaternion<double> > >::Scalar& {aka double&}’ discards qualifiers EIGEN_DEVICE_FUNC inline Scalar& w() { return this->derived().coeffs().coeffRef(3); }
Fixed: https://bitbucket.org/eigen/eigen/commits/36032105e83c/ https://bitbucket.org/eigen/eigen/commits/69652a06967d/ (3.3)
-- GitLab Migration Automatic Message -- This bug has been migrated to gitlab.com's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.com/libeigen/eigen/issues/1461.