public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52761] New: [C++11] Missing diagnostic for opaque unscoped enum declaration without base
@ 2012-03-29 2:16 hstong at ca dot ibm.com
2012-04-13 20:13 ` [Bug c++/52761] " jason at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: hstong at ca dot ibm.com @ 2012-03-29 2:16 UTC (permalink / raw)
To: gcc-bugs
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: unassigned@gcc.gnu.org
ReportedBy: hstong@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)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/52761] [C++11] Missing diagnostic for opaque unscoped enum declaration without base
2012-03-29 2:16 [Bug c++/52761] New: [C++11] Missing diagnostic for opaque unscoped enum declaration without base hstong at ca dot ibm.com
@ 2012-04-13 20:13 ` jason at gcc dot gnu.org
2021-07-27 0:53 ` pinskia at gcc dot gnu.org
2021-07-27 23:18 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-13 20:13 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52761
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-04-13
CC| |jason at gcc dot gnu.org
Ever Confirmed|0 |1
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-13 20:12:33 UTC ---
I think you're right.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/52761] [C++11] Missing diagnostic for opaque unscoped enum declaration without base
2012-03-29 2:16 [Bug c++/52761] New: [C++11] Missing diagnostic for opaque unscoped enum declaration without base hstong at ca dot ibm.com
2012-04-13 20:13 ` [Bug c++/52761] " jason at gcc dot gnu.org
@ 2021-07-27 0:53 ` pinskia at gcc dot gnu.org
2021-07-27 23:18 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-27 0:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52761
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
clang declared this as a GNU extention :)
<source>:2:6: error: redeclaration of already-defined enum 'E' is a GNU
extension [-Werror,-Wgnu-redeclared-enum]
enum E; // illegal
^
<source>:1:6: note: previous definition is here
enum E { X };
^
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/52761] [C++11] Missing diagnostic for opaque unscoped enum declaration without base
2012-03-29 2:16 [Bug c++/52761] New: [C++11] Missing diagnostic for opaque unscoped enum declaration without base hstong at ca dot ibm.com
2012-04-13 20:13 ` [Bug c++/52761] " jason at gcc dot gnu.org
2021-07-27 0:53 ` pinskia at gcc dot gnu.org
@ 2021-07-27 23:18 ` pinskia at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-07-27 23:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52761
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |anders.granlund.0 at gmail dot com
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 67016 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-27 23:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-29 2:16 [Bug c++/52761] New: [C++11] Missing diagnostic for opaque unscoped enum declaration without base hstong at ca dot ibm.com
2012-04-13 20:13 ` [Bug c++/52761] " jason at gcc dot gnu.org
2021-07-27 0:53 ` pinskia at gcc dot gnu.org
2021-07-27 23:18 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).