http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52761
Bug #: 52761 Summary: [C++11] Missing diagnostic for opaque unscoped enum declaration without base Classification: Unclassified Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: hst...@ca.ibm.com Host: powerpc64-unknown-linux-gnu Target: powerpc64-unknown-linux-gnu ### Self-contained source:$ cat enumredecl.cc enum E { X }; enum E; // illegal ### Analysis: For C++2011, subclause 7.2 [dcl.enum] paragraph 2 says: An opaque-enum-declaration declaring an unscoped enumeration shall not omit the enum-base. The code is also invalid under C++03. The "redeclaration" does not meet the requirements in C++03 clause 7 [dcl.dcl] paragraph 3 for the omission of the init-declarator-list in a simple- declaration. Namely, it is not a class definition or declaration and is not a enum definition. It also fails to requirements in subclause 7.1.5.3 [dcl.type.elab] paragraph 1 for an elaborated-type-specifier that is the sole constituent of a declaration. Namely, it is neither an explicit specialization, explicit instantiation, class declaration nor friend class declaration. ### Compiler invocations: $ g++-4.6.0 --std='c++0x' -Wall -W -pedantic enumredecl.cc -c $ g++-4.6.0 --std='c++98' -Wall -W -pedantic enumredecl.cc -c ### Compiler output (both cases): (return code 0) ### g++ -v output:$ g++-4.6.0 -v Using built-in specs. COLLECT_GCC=g++-4.6.0 COLLECT_LTO_WRAPPER=/data/gcc/libexec/gcc/powerpc64-unknown-linux-gnu/4.6.0/lto-wrapper Target: powerpc64-unknown-linux-gnu Configured with: ./configure --prefix=/data/gcc --program-suffix=-4.6.0 --disable-libssp --disable-libgcj --enable-version-specific-runtime-libs --with-cpu=default32 --enable-secureplt --with-long-double-128 --enable-shared --enable-__cxa_atexit --enable-threads=posix --enable-languages=c,c++,fortran --with-gmp=/usr/local Thread model: posix gcc version 4.6.0 (GCC)