------- Comment #4 from bergner at gcc dot gnu dot org  2010-04-23 16:15 -------
Interesting, using:

  union __attribute__ ((transparent_union)) q
  {
    unsigned n;
    unsigned get_n () const { return n; }
  };

does seem to cure it.  However, is the attribute location really incorrect?  It
seems the gcc docs on variable attributes have several examples where an
attribute is located at the end of the declaration.  And the attribute syntax
documention has this tidbit:

An attribute specifier list may appear as part of a struct, union or enum
specifier. It may go either immediately after the struct, union or enum
keyword, or after the closing brace. The former syntax is preferred. Where
attribute specifiers follow the closing brace, they are considered to relate to
the structure, union or enumerated type defined, not to any enclosing
declaration the type specifier appears in, and the type defined is not complete
until after the attribute specifiers. 

So it looks to me like it should work where I have it, doesn't it?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43859

Reply via email to