From some C code, I get several constants like int *. In the C ++ part, I have an enumeration of the int base type. Converting between enum and int based on a single value works. However, a conversion between int *and is enum *not possible. See the sample code below.
Why is this and how to convert a pointer to some int values to a pointer to int enums and vice versa? I kind of expect it to work since operations with the same value work, and the base types are the same. I read about What happens if you do not statically indicate the value of the enum class? but could not determine if invalid values are playing here.
int i = 3;
enum E : int;
E e;
e = static_cast<E>(i);
i = static_cast<int>(e);
int *j;
E * f;
j = static_cast<int *>(&i);
f = static_cast<E *>(&i);
j = static_cast<int *>(&e);
*j = *f;