Why can I set an anonymous enum equal to another in C but not C++?
- by samoz
I have the following code snippet:
enum { one } x;
enum { two } y;
x = y;
That will compile in C, but in C++, I get the following error:
test.c:6: error: cannot convert ‘main()::<anonymous enum>’ to ‘main()::<anonymous enum>’ in assignment
Can someone explain to me why this is happening? I would prefer an answer with some specifics about why the compiler behaves this way, rather than just "You can't do that"