Suppose we have below code:
class A {
uint32_t X;
uint32_t Y;
};
int main ()
{
A a;
uint64_t num = (uint64_t)a;
}
The compiler gives error: "Cannot convert from A to uint64_t. No User define conversion operator defined."
Is the error expected and if yes, why?
Definitely undefined behavior, but try