This is a strict aliasing violation, plain and simple. Any access with that pointer, to any element but the first, is undefined behavior in your case. And in more complex cases it's just plain undefined behavior regardless of which element you access.
If you need an array, use an array. std::array
also has an overload for for std::get
, so you can use that to name each individual array member:
using A = std::array;
enum AElement { X, Y, Z };
int main() {
A a;
get(a) = 3.0f; // sets X;
float* array = a.data(); // perfectly well defined
}