Article View: gnu.gcc.bug
Article #144gcc 1.35 problem with typedef of pointer to function with struct parameter
From: Mike Coleman
Date: Wed, 05 Jul 1989 22:35
Date: Wed, 05 Jul 1989 22:35
39 lines
1563 bytes
1563 bytes
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)
Technical Details
Message-ID:
<8907052235.AA24676@burns.twinsun.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!twinsun.com!colemanShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!twinsun.com!coleman From: coleman@twinsun.com (Mike Coleman) Newsgroups: gnu.gcc.bug Subject: gcc 1.35 problem with typedef of pointer to function with struct parameter Message-ID: <8907052235.AA24676@burns.twinsun.com> Date: 5 Jul 89 22:35:21 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 39