https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87035
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|RESOLVED |NEW Last reconfirmed| |2018-08-21 Resolution|INVALID |--- Summary|Can't shadow global const |Add "note: used here" to |int with unnamed enum in |permerror about |class |redeclaration changing the | |meaning of a name at class | |scope Ever confirmed|0 |1 Severity|normal |enhancement --- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- Yup, this is ill-formed; no diagnostic required.(In reply to Andrew Pinski from comment #1) > Actually no this is invalid code at least according to the standard. Since Yup, ill-formed; no diagnostic required. GCC has been getting smarter about diagnosing these cases. > Maybe just the use of N is not in the error message. Yes, maybe a note pointing to the use of the name would be useful. 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; ^ t8.cc:4:13: note: used here int Array[N]; // int[5] ^ Re-opening as a diagnostic bug.