This is a suggestion for improving the documentation rather than a bug. Sorry for submitting it here, is there some more reasonable place? The work around of aligning my own classes with EIGEN_MAKE_ALIGNED_OPERATOR_NEW as explained in http://eigen.tuxfamily.org/dox/group__TopicStructHavingEigenMembers.html can also be avoided by using pointers to Eigen classes, instead of members. This is a little easier than the "Private structure" solution described at the bottom of the page. I.e. just using class Foo { ... Eigen::Vector2d *v; ... Foo(...):v(new Eigen::Vector2d()){...} ~Foo(){delete v;...} }; instead of class Foo { ... Eigen::Vector2d v; ... }; fixes the problem as well as the more complicated solutions described in the documentation.
This makes sense if you have only one vector or matrix, but if you have more then it's much better to group them into a helper structure, so I'm not sure about adding this example. Perhaps as a degenerate case of the private structure example?
The example in the docu, as well as Sebastian's suggestion is flawed, because calling the assignment operator or copy constructor will lead to errors (multiple deallocations). If someone wants to use that solution, smart-pointers should be used (also saves the effort of implementing the destructor).
-- 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/805.