From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8739 invoked by alias); 19 Apr 2004 13:09:36 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 8728 invoked from network); 19 Apr 2004 13:09:35 -0000 Received: from unknown (HELO s1.mailresponder.info) (81.2.143.10) by sources.redhat.com with SMTP; 19 Apr 2004 13:09:35 -0000 Received: from [192.168.4.70] (82.98.209.5) by s1.mailresponder.info with MERCUR Mailserver (v4.02.10 ODAtMjQzOS03MTc5) for ; Mon, 19 Apr 2004 15:07:54 +0200 Subject: Anonymous union members problem From: Mathieu Fluhr To: gcc-help@gcc.gnu.org Content-Type: text/plain Message-Id: <1082380113.10142.9.camel@c-l-175> Mime-Version: 1.0 Date: Mon, 19 Apr 2004 13:09:00 -0000 Content-Transfer-Encoding: 7bit X-SW-Source: 2004-04/txt/msg00241.txt.bz2 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::::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