[Bug c/49182] Fordward declarations of struct not usable in function pointer types.
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 26 23:48:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49182
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-26 23:44:43 UTC ---
(In reply to comment #3)
> (In reply to comment #2)
> > I forgot to mention GCC compiles it correctly with the C++ front-end.
>
> Removing the typedefs will still cause compilation to error out not knowing
> what a is. For example:
>
> // Forward declaration
> struct a;
You've declared the type "struct a"
> // Pointer to function with struct as parameter
> typedef int (*FxnPointer)(a* WontComplie);
You've tried to use "a" which is undeclared
> // Actual declaration of struct with function pointer type declared above.
> struct _a
> {
> int foo;
> int bar;
> FxnPointer PtrToFxn;
> } a;
Now you've declared a variable called "a" with type "struct _a"
More information about the Gcc-bugs
mailing list