public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mathieu Fluhr <mfluhr@nero.com>
To: gcc-help@gcc.gnu.org
Subject: Anonymous union members problem
Date: Mon, 19 Apr 2004 13:09:00 -0000	[thread overview]
Message-ID: <1082380113.10142.9.camel@c-l-175> (raw)

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

             reply	other threads:[~2004-04-19 13:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-19 13:09 Mathieu Fluhr [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1082380113.10142.9.camel@c-l-175 \
    --to=mfluhr@nero.com \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).