This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/8656: Unable to assign function with __attribute__ and pointer return type to an appropriate variable
- From: ehrhardt at mathematik dot uni-ulm dot de
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, rmathew at hotmail dot com
- Date: 5 Dec 2002 13:54:16 -0000
- Subject: Re: c++/8656: Unable to assign function with __attribute__ and pointer return type to an appropriate variable
- Reply-to: ehrhardt at mathematik dot uni-ulm dot de, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, rmathew at hotmail dot com, gcc-gnats at gcc dot gnu dot org
Synopsis: Unable to assign function with __attribute__ and pointer return type to an appropriate variable
State-Changed-From-To: open->analyzed
State-Changed-By: cae
State-Changed-When: Thu Dec 5 05:54:11 2002
State-Changed-Why:
I'm not sure if this is a bug or nor. The problem is that the
types actually differ because the attribute applies to different
parts of the declaration. In
int * __attribute__((stdcall)) F (void) {};
the attribute is applied to the return type not to the function type.
In the extern declaration
extern int * (__attribute__((stdcall)) * f) (void);
the attribute is applied to the function type. I'm not 100% sure if
this is intended or a parser error but I suspect it is intended.
As a result of this the error itself is justified because calling
conventions for the function and the function pointer differ. The
text of the error however isn't helful at all.
Workaround: Put explicit parenthesis around the attribute and
the function name:
int * (__attribute__(stdcall)) F) (void) {};
regards Christian
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8656