This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Variables whose types are anonymous structs, once again
- From: Matt Austern <austern at apple dot com>
- To: law at redhat dot com
- Cc: gcc mailing list <gcc at gcc dot gnu dot org>
- Date: Wed, 19 May 2004 12:31:19 -0700
- Subject: Re: Variables whose types are anonymous structs, once again
- References: <200405191909.i4JJ9JfL030772@speedy.slc.redhat.com>
On May 19, 2004, at 12:09 PM, law@redhat.com wrote:
In message <83960454-89A5-11D8-8C46-000A95BCF344@apple.com>, Matt
Austern write
s:
OK, I raised this issue once before. I know more now than I did then,
so I'm raising it again.
The mainline C++ compiler gives an error (a pedwarn, which is treated
as an error by default) if you do this:
enum { a } x;
[ ... ]
Did this ever get resolved one way or the other? There's a ton of C++
code which trips over these kinds of things and it'd be good to know if
we need to pester those projects to get their code fixed or not.
I now believe that this code is clearly legal. The standards committee
explicitly considered this case and decided not to make it illegal.
I also believe that this code is on slightly thin ice. There are some
constructs that are very similar but that are illegal. I suspect, also,
that "enum { a } x;" will probably be made illegal in a future version
of the standard. So we might want to consider warning about this.
But for the moment, in the existing standard, this is legal. The fact
that we give an error message is a compiler bug.
--Matt