On Thu, Apr 4, 2013 at 7:26 AM, Sebastian Hartte <[email protected]> wrote:
>
> I have a question regarding the declaration of function pointers with
> stdcall calling convention.

This question is not appropriate for the mailing list [email protected],
which is for the development of GCC.  It would be appropriate for
[email protected].  Please take any followups to gcc-help.  Thanks.


> This compiles for me (using g++ -c test.cpp -o test.o):
>
> typedef struct _a {
>     int (__stdcall *a)();
> } a;
>
> While this does not:
> typedef struct _t {
> } t;
>
> typedef struct _a {
>     t (__stdcall *a)();
> } a;
>
> It gives me the following error:
> test.cpp:6:15: error: expected identifier before '*' token
> test.cpp:6:16: warning: '__stdcall__' attribute only applies to function
> types [-Wattributes]
> test.cpp:6:19: error: ISO C++ forbids declaration of 't' with no type
> [-fpermissive]
> test.cpp:6:19: error: 't' declared as function returning a function
>
> Am I using __stdcall incorrectly? If so, why does it work for primitive
> return types. If I am using it correctly,
> should I file this as a bug against gcc?

I think this is just another instance of the "most vexing parse".  Try
another pair of parentheses:
    t ((__stdcall *a)());

Ian

Reply via email to