Forward referencing with typedef

Divyesh divyeshunadkat001@gmail.com
Fri Dec 9 07:27:00 GMT 2011


Hi,

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
doesn't.

I think this is a gcc bug.

Request assistance for the same.

Thanks and Regards,
Divyesh
-- 
View this message in context: http://old.nabble.com/Forward-referencing-with-typedef-tp32939060p32939060.html
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list