It is currently possible to directly create PlainObjectBase<Derived> objects, which is not very good practice as this class has been thought as an abstract base class. So what about disabling this possibility by making all PlainObjectBase<Derived> private, and making Derived a friend class of PlainObjectBase<Derived>? See also the following thread for some weird usages of PlainObjectBase<Derived>: https://forum.kde.org/viewtopic.php?f=74&t=128414&p=342621
I also see no legit use of directly creating a PlainObjectBase<> (nor any other ...Base<>-object -- which in many cases would be an empty object, which behaves as if it contained data). To implement this, wouldn't it be sufficient to make all constructors (and destructors, if needed) protected? Of course, this would leave the possibility to inherit class WeirdClass : PlainObjectBase<SomeOtherClass> { ... }; but we can't avoid every possibility to shoot oneself in the foot ...
yes, making them protected is definitely enough!
What about making the destructor of PlainObjectBase<typename> a pure virtual function? This would need only two additional lines of code and no changes to any of the derived classes.
We use pure static polymorphism in Eigen (no virtual functions). A pure virtual destructor is actually rather complicated (I was surprised that it is even possible ...)
https://bitbucket.org/eigen/eigen/commits/9eea85f21eed/
-- 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/1074.