From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26143 invoked by alias); 24 Nov 2003 15:56:37 -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 26128 invoked from network); 24 Nov 2003 15:56:36 -0000 Received: from unknown (HELO cam-admin0.cambridge.arm.com) (193.131.176.58) by sources.redhat.com with SMTP; 24 Nov 2003 15:56:36 -0000 Received: from pc960.cambridge.arm.com (pc960.cambridge.arm.com [10.1.205.4]) by cam-admin0.cambridge.arm.com (8.12.10/8.12.10) with ESMTP id hAOFuZbo012037; Mon, 24 Nov 2003 15:56:35 GMT Received: from pc960.cambridge.arm.com (rearnsha@localhost) by pc960.cambridge.arm.com (8.11.6/8.9.3) with ESMTP id hAOFuZo11705; Mon, 24 Nov 2003 15:56:35 GMT Message-Id: <200311241556.hAOFuZo11705@pc960.cambridge.arm.com> X-Authentication-Warning: pc960.cambridge.arm.com: rearnsha owned process doing -bs To: Ashutosh Dixit cc: gcc@gcc.gnu.org, gcc-help@gcc.gnu.org, Richard.Earnshaw@arm.com Reply-To: Richard.Earnshaw@arm.com Organization: ARM Ltd. X-Telephone: +44 1223 400569 (direct+voicemail), +44 1223 400400 (switchbd) X-Fax: +44 1223 400410 X-Address: ARM Ltd., 110 Fulbourn Road, Cherry Hinton, Cambridge CB1 9NJ. X-Url: http://www.arm.com/ Subject: Re: "Incomplete type" and "redefinition" errors in gcc In-reply-to: Your message of "Mon, 24 Nov 2003 07:46:12 PST." <20031124154612.12844.qmail@web20514.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 24 Nov 2003 15:56:00 -0000 From: Richard Earnshaw X-SW-Source: 2003-11/txt/msg00315.txt.bz2 > Hi, > > If I compile the following simple C code with gcc: > ________________try.c________________________ > > typedef enum VIDF VIDF; > typedef unsigned int U32; > typedef unsigned int U32; > > typedef struct VIDR > { > VIDF VidF; > U32 width; > } VIDR; > > typedef enum VIDF > { > aVIDF, > bVIDF > } VIDF; > > int main( void ) > { > return 0; > } > ____________________________________________ > > I get the following errors: > > bash-2.05b$ gcc try.c > try.c:3: error: redefinition of `U32' > try.c:2: error: `U32' previously declared here > try.c:7: error: field `VidF' has incomplete type > try.c:15: error: redefinition of `VIDF' > try.c:1: error: `VIDF' previously declared here All of these diagnostics are correct. You can't repeat typedefs, and you can't instantiate a forward declaration of an enum. R.