[Bug c/49182] Fordward declarations of struct not usable in function pointer types.
brad.lionberger at intel dot com
gcc-bugzilla@gcc.gnu.org
Thu May 26 23:36:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49182
--- Comment #3 from Brad <brad.lionberger at intel dot com> 2011-05-26 23:23:17 UTC ---
(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;
// Pointer to function with struct as parameter
typedef int (*FxnPointer)(a* WontComplie);
// Actual declaration of struct with function pointer type declared above.
struct _a
{
int foo;
int bar;
FxnPointer PtrToFxn;
} a;
int main(void)
{
return 0;
}
Resutls are :
FxnPtrEx.c:5:28: error: expected ‘)’ before ‘*’ token
FxnPtrEx.c:12:2: error: expected specifier-qualifier-list before ‘FxnPointer’
It seems to not take the forward declaration of the struct as a member of the
parameter list of the FxnPointer type, unless I am missing something here.
What I am trying to do is create a function pointer that takes in as a
parameter a pointer to a structure, but in that structure is a function pointer
of that type. I am confused as to why the forward declaration is not working
here.
More information about the Gcc-bugs
mailing list