Forward referencing with typedef

Fri Dec 9 07:27:00 GMT 2011


Please refer to the following code snippet.

struct strArr;

typedef struct strArr myStAr[17];

typedef struct
	unsigned short DISPLAY_:1;
} structDisp;

typedef structDisp disp;

struct strArr
	disp dispBit;
} ;

int f()
	return 0;

In the code we have a typedef to an array of struct.

Now since the definition of that struct is given after the use, gcc cribs.

The error reported by gcc is : array type has incomplete element type.

Interesting thing is gcc 3.4.4 compiles the code where as gcc 4.3.4 and 4.6

I think this is a gcc bug.

Request assistance for the same.

Thanks and Regards,
View this message in context:
Sent from the gcc - Help mailing list archive at

More information about the Gcc-help mailing list