public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Anonymous union members problem
@ 2004-04-19 13:09 Mathieu Fluhr
  2004-04-19 13:15 ` Eljay Love-Jensen
  2004-04-19 14:53 ` llewelly
  0 siblings, 2 replies; 6+ messages in thread
From: Mathieu Fluhr @ 2004-04-19 13:09 UTC (permalink / raw)
  To: gcc-help

Hello

I am porting VC++ source code to Linux using g++ 3.3 and I am currently
getting some errors with C++ code like this sample program:


struct foo
{
  struct
  {
    typedef int structType; 
    union
    { 
      int test;
    };
  };
};

int main()
{
  return 0;
}

When I try to compile this program, I get the following message:

mathieu@c-l-175:~/tests/bitfields$ g++-3.3 -Wall bitfields.cpp
bitfields.cpp:5: error: `typedef int foo::<anonymous
struct>::structType'
   invalid; an anonymous union can only have non-static data members

Is this invalid C++ code ? If yes is there a way to make it valid and
compilable under Linux ?

Regards,
Mathieu

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-04-19 14:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-19 13:09 Anonymous union members problem Mathieu Fluhr
2004-04-19 13:15 ` Eljay Love-Jensen
2004-04-19 13:55   ` Mathieu Fluhr
2004-04-19 14:28     ` Eljay Love-Jensen
2004-04-19 14:59     ` llewelly
2004-04-19 14:53 ` llewelly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).