The following assignment should not work: void triangConstTest(const Eigen::MatrixXd& A) { Eigen::TriangularView<Eigen::MatrixXd, Eigen::Upper> T(A); T(0,0) = 0.0; // violates const correctness! }
Actually, it should even fail at the first line because the first template argument should be const qualified: TriangularView<const MatrixXd, Upper> T(A);
Same problem with CwiseUnaryView: void viewConstTest(const Eigen::MatrixXd& A) { Eigen::CwiseUnaryView<internal::scalar_real_ref_op<double>, Eigen::MatrixXd> T(A); T.coeffRef(0,0) = 0.0; // violates const correctness! } and probably with SeflAdjointView too. Only Transpose and Block seems to behave properly.
The regression unit tests: https://bitbucket.org/eigen/eigen/commits/7e652ad5b688/ Changeset: 7e652ad5b688 User: ggael Date: 2014-09-23 08:26:02+00:00 Summary: Bug 882: add const-correctness failtests for CwiseUnaryView, TriangularView, and SelfAdjointView. Still need to fix them...
https://bitbucket.org/eigen/eigen/commits/15747271eb5a/ Changeset: 15747271eb5a User: ggael Date: 2014-10-07 16:29:28+00:00 Summary: Bug 882: fix various const-correctness issues with *View classes.
-- 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/882.