[gnu.gcc.bug] gcc 1.35 problem with typedef of pointer to function with struct parameter

coleman@twinsun.com (Mike Coleman) (07/06/89)

I am having a problem with this piece of code:

	void good()
	{
	  void (*f)(int a,struct { int b; },int c);
	}

	typedef void (*ft)(int a,struct { int b; },int c);

	void bad()
	{
	  ft f;
	}

which when compiled with this command line:

	gcc -c foo.c

produces these error messages:

	try.c: In function bad:
	try.c:10: `ft' undeclared (first use this function)
	try.c:10: (Each undeclared identifier is reported only once
	try.c:10: for each function it appears in.)
	try.c:10: parse error before `f'

As far as I can tell, this is a correct (though admittedly useless) ANSI C
translation unit.  Removing 'struct { int b; },' from the typedef line will
allow the program to compile without errors.  The program was compiled on a
Sun 3/260 running SunOS 4.0.

I realize that the type definition given is seriously pathological even if
legal, but the error messages are puzzling.  If this is not in fact a
correct program, a reference or an explanation would be greatly appreciated.

Please keep up the good work on this excellent compiler!

--Mike
(coleman@twinsun.com or coleman@cs.ucla.edu)