public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/49182] New: Fordward declarations of struct not usable in function pointer types.
@ 2011-05-26 23:10 brad.lionberger at intel dot com
  2011-05-26 23:12 ` [Bug c/49182] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: brad.lionberger at intel dot com @ 2011-05-26 23:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49182

           Summary: Fordward declarations of struct not usable in function
                    pointer types.
           Product: gcc
           Version: 4.5.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: brad.lionberger@intel.com


A forward declaration of a struct to be used in a function pointer type
definition confuses the compiler.  The following code does not compile using
gcc but will with two other compilers.

// Forward declaration
typedef struct _a a;  

// Pointer to function with struct as parameter
typedef int (*FxnPointer)(a* WontComplie);

// Actual declaration of struct with function pointer type declared above.
typedef struct _a
{
    int foo;
    int bar;
    FxnPointer PtrToFxn;
} a;

int main(void)
{
    a test_struct;

    return 0;
}

Errors returned are as follows:
FxnPtrEx.c:13:3: error: redefinition of typedef ‘a’
FxnPtrEx.c:2:19: note: previous declaration of ‘a’ was here


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-05-26 23:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-26 23:10 [Bug c/49182] New: Fordward declarations of struct not usable in function pointer types brad.lionberger at intel dot com
2011-05-26 23:12 ` [Bug c/49182] " pinskia at gcc dot gnu.org
2011-05-26 23:23 ` pinskia at gcc dot gnu.org
2011-05-26 23:36 ` brad.lionberger at intel dot com
2011-05-26 23:45 ` pinskia at gcc dot gnu.org
2011-05-26 23:48 ` redi at gcc dot gnu.org
2011-05-27  1:24 ` brad.lionberger at intel dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).