samedi 14 mars 2015

Why must an enumeration's size be provided when it is forward declared?


I just can't see why the size of the enumeration is relevant for the compiler while the size of the class is not.


My code example:



class A;
enum E; // must be enum E : int; in order to compile

void f(const A & param);
void f(const E & param);


I'm talking here of standard C++ compilers. I know that MSVC let it compile and works fine. So the question is:


Why this has not been standardized?




Aucun commentaire:

Enregistrer un commentaire