https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87035
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Actually no this is invalid code at least according to the standard. Since N definition has to be the same when used and at the end of the scope. In this case, you have a different one. The error message is very clear about that too: t8.cc:5:10: error: declaration of ‘N’ [-fpermissive] enum { N }; // fails, redeclaration ^ t8.cc:1:11: error: changes meaning of ‘N’ from ‘const int N’ [-fpermissive] const int N = 5; ^ Maybe just the use of N is not in the error message.