[gnu.gcc.bug] Strange interaction between prototypes and typedefs

scs@lokkur.UUCP (Steve Simmons) (06/06/89)

I dunno if this is a bug in gcc or just my misunderstanding of how
prototypes work.  The following program, odd.c, does not compile with
gcc version 1.34 on the UNIX-PC:

------------------------- start odd.c ---------------------------------
typedef char	deftype ;

extern void	function( deftype ) ;

#ifdef	SHOW_ODD
void	function( b )
deftype b ;
#else
void	function( deftype b )
#endif
{
	(void) printf( "function called.\n" ) ;
}

main()
{
	deftype	parameter = 'i' ;
	function( parameter ) ;
}
------------------------- start odd.c ---------------------------------

Trying the compile with `gcc -DSHOW_ODD odd.c' gives the error messages:

odd.c: In function function:
odd.c:11: argument `b' doesn't match function prototype
odd.c:11: a formal parameter type that promotes to `int'
odd.c:11: can match only `int' in the prototype

Do the same without the -DSHOW_ODD switch and it compiles OK.
-- 
:  "Coprophilia is not a disease or an abberation.  It is a legitimate   :
:   alternative lifestyle."                                              :
:  "Hey Phil -- what's for lunch?"   -- from "Clonezone" by Mike Baron   :
Steve Simmons		...sharkey!lokkur!scs      scs@lokkur.dexter.mi.us