PATCH for over-aggressive handling of unnamed structs

Mark Mitchell mark@markmitchell.com
Sun May 24 15:20:00 GMT 1998


>>>>> "Martin" == Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de> writes:

    >> We seem to be giving the name `S' to the underlying struct in
    >> this case:
    >> 
    >> typedef const struct { } S;
    >> 
    >> which is bogus.

    Martin> Hmm. 7.1.3 [dcl.typedef]/5 does not restrict this to
    Martin> non-cv-qualified types.

I think your interpretation is wrong.  The standard says:

  5 If the typedef declaration defines an unnamed class (or enum), the
    first typedef-name declared by the declaration to be that class
    type (or enum type) is used to denote the class type (or enum
    type) for linkage purposes only (_basic.link_).

Here, `S' does not have `that class type'; it has a cv-qualified
version of that class type.  You're proposing that `S' be the name of
the unqualified struct, but `const S' and `S' be alternative names for
the const-qualified version.  (Yes, I know one name is for linkage
purposes only.)

I confirmed my interpretation with several members of the committee
yesterday, FWIW.

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com



More information about the Gcc-bugs mailing list