-
Notifications
You must be signed in to change notification settings - Fork 463
Description
Issue description
In C++26, the implicit conversion to underlying types for anonymous enums in operations (such as bitwise ops) will be removed. Right now there is a compiler warning about the deprecation, since at least Clang++14 according to what I've seen online.
Relevant issue on Eigen's GitLab: https://gitlab.com/libeigen/eigen/-/issues/1826
- This was fixed with this MR on Eigen last year, by explicitly converting anonymous enum values to
int
One of the warnings I'm getting is this:
/path/to/pin/repo/include/pinocchio/context/generic.hpp:54:83: warning: bitwise operation between different enumeration types ('Eigen::StorageOptions' and 'pinocchio::context::(unnamed enum at /path/to/pin/repo/include/pinocchio/context/generic.hpp:47:5)') is deprecated [-Wdeprecated-anon-enum-enum-conversion]
54 | typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor | Options>
| ~~~~~~~~~~~~~~~ ^ ~~~~~~~
Pinocchio contains the following offending code in the context headers:
pinocchio/include/pinocchio/context/generic.hpp
Lines 77 to 83 in d1e1f68
namespace context | |
{ | |
typedef PINOCCHIO_SCALAR_TYPE Scalar; | |
enum | |
{ | |
Options = PINOCCHIO_OPTIONS_DEFAULT | |
}; |
And in some other classes I think.
Suggested change
Since these are compile-time constants, we can switch them to something like
namespace context
{
// ...
static constexpr int Options = PINOCCHIO_OPTIONS_DEFAULT;
}
in generic.hpp
, and perhaps some using
statements in other namespaces and other static constexpr int [...]
declarations in classes.
We could also adopt the solution from the MR on Eigen but I think these anon enum values to int
everywhere would be tedious.