C bug? in 2.95.1

JDonner jdonnerATschedsys.com
Tue Sep 14 14:58:00 GMT 1999


The following compiles fine, the 'declaration' of Unknown in 
SomeStruct seems to allow UserOfUnknown to use it.  But shouldn't 
that declaration disappear outside the struct?  
Or if C just blindly accepts pointers to structs shouldn't it work 
within a function, too?  UserOfUnknown gets an error without 
the decl. within SomeStruct.

Thanks,

Jeff

------------------------------------
/* bug.c */
struct SomeStruct
{
  int a;
  struct Unknown* pUnknown;
};

extern void UserOfUnknown(struct Unknown* pUnknown);

int main()
{
  return 0;
}


I used
gcc -Wall -pedantic -ansi bug.c

gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/specs
gcc version 2.95.1 19990816 (release)


More information about the Gcc-bugs mailing list