This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "Incomplete type" and "redefinition" errors in gcc


Richard Earnshaw <rearnsha@arm.com> writes:

| > 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;

[...]

| All of these diagnostics are correct.   You can't repeat typedefs, and you 
| can't instantiate a forward declaration of an enum.

I see the original poster was mentioning C.  However, I just wanted to
add that in C++, it is permitted to repeat a typedef declaration
provided it binds the same tokens.  The enum forward declaration
restrictions are same in both languages.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]