This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/30300] Bogus diagnostic for anonymous structs/classes



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]