This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/8656: Unable to assign function with __attribute__ and pointer return type to an appropriate variable


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]