I have function readXml( int& var, XMLNode *node )
and variable enum Mode { On, Off, Auto }; Mode mode;
.
I want to read this like readXml( (int&) mode, node1 );
but compiler says
error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
Of course, I can write something like:
int t;
readXml(t, node);
mode = static_cast<Mode>(t);
How can I fix this code in one-line.