Skip to content

Make assignment operators consistent with standard signature

This is needed to support conditionally trivially copyable Matrix and Array when they are fixed-sized, which require explicitly defaulted trivial copy assignment operators for all their base classes. But the defaulted copy assignment operators have different return types than those of the current non-trivial copy assignment operators, resulting in implicit inconsistency and potentially hard to debug behaviors.

Therefore make the non-trivial copy assignment operators of all the base classes return consistent types with the trivial ones. To ensure consistency, all other simple assignment operators are also changed in the same way.

This is an API breaking change:

Assignment operators of some Eigen classes used to return Derived&. Now assignment operators of every classes return references to the class itself.

Chained calls that use the return type of assignment operators, e.g. (x = y).foo() or return x = y; should be updated to explicitly use the most specific derived type, e.g. (x = y).derived().foo() or x = y; return x;.

Edited by Lingzhu Xiang

Merge request reports