C syntax problem in gcc

Joerg Czeranski jc@joerch.org
Wed Apr 5 11:30:00 GMT 2000


Hi,
I have a C syntax problem with "gcc version 2.95.1 19990816 (release)"
(and also older versions, like e.g. 2.8.1) on "SunOS 5.5.1 sun4u sparc".

For this source code:

  typedef int x;
  void proc(int (*x)(void)) {}

gcc reports:

  gcc_bug.c:2: parse error before `x'
  gcc_bug.c:2: parse error before `)'


This happens with "gcc -c" and any or none of "-ansi" and "-pedantic".
No .o file is generated in any case.

The example source declares a function named "proc" with a single
parameter named "x" of type pointer to function with no parameters,
returning int.  This parameter has block scope and hides the
file scope type definition "x".

Thus it's legal ISO C in my opinion.

Sparcworks 4.0 and DEC C V5.6-075 accept the source.

greetings,
Jörg Czeranski


More information about the Gcc-bugs mailing list