In "/src/Core/Assign.h" (tested Eigen 3.2.8), there are a few `enum`s that use `&&`. E.g. enum { //... MightVectorize = StorageOrdersAgree && (int(Derived::Flags) & int(OtherDerived::Flags) & ActualPacketAccessBit), //... }; The problem is that (for the above example) `StorageOrdersAgree` isn't a boolean; it's another element of the enum. This produces GCC warnings like: /usr/include/eigen3/Eigen/src/Core/Assign.h:49:19: warning: logical ‘and’ applied to non-boolean constant [-Wlogical-op] && (int(Derived::Flags) & int(OtherDerived::Flags) & ActualPacketAccessBit), ^ There are several other examples in that file.
Hm, we probably should fix that ... Essentially, we have two alternatives: Casting every enum to bool/int before using it (we already cast a lot to int), or declaring enums as static const bool/int instead. Either way will require touching most of our internal logic. We had a discussion about the latter some time ago: There is a minor drawback that this won't allow to use enums directly in functions which expect (const Index&) parameters: http://thread.gmane.org/gmane.comp.lib.eigen/4960 So casting everything to bool() is at least easier/safer, but slightly reduces readability/usability (e.g., user which want to use our flags need to cast them to bool as well, if they want to comply with -Wlogical-op).
I'd go with the casting solution, which is already what we are doing.
Fixed here (devel branch only): https://bitbucket.org/eigen/eigen/commits/5cdfa660882
-- 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/1207.