This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/30300] Bogus diagnostic for anonymous structs/classes
- From: "richard-gccbugzilla at metafoo dot co dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Jun 2007 17:21:51 -0000
- Subject: [Bug c++/30300] Bogus diagnostic for anonymous structs/classes
- References: <bug-30300-1771@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from richard-gccbugzilla at metafoo dot co dot uk 2007-06-05 17:21 -------
Points worthy of note:
1) The OP's code is legal (to my reading of the standard) but meaningless.
Private members in unnamed classes are legal, while private members in
anonymous unions are not. So technically this should be tagged as
rejects-valid.
2) If the code is made meaningful by defining a variable whose type is the
unnamed class, the incorrect diagnostic goes away:
struct A
{
class
{
static int i;
int j;
} k;
};
3) In my opinion, it would be valuable to produce a diagnostic in the situation
of the code in comment#0, as a quality of implementation issue. I'm not sure
whether the standard requires a diagnostic here. Comeau produces an error in
this case ("declaration does not declare anything").
--
richard-gccbugzilla at metafoo dot co dot uk changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |richard-gccbugzilla at
| |metafoo dot co dot uk
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30300