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]

The placement of __attribute__ confuses g++



extern int atexit (void (*__func) (void)) throw ();

class SomeClass
{
public:
    void  (__attribute__((__stdcall__)) *m_func)();
    //void __attribute__((__stdcall__)) (*m_func)();
};

void foo()
{
}

char _term = (char)atexit(&foo);



   When I compile the above with g++ from CVS 20010102 I get:
$ g++ -c test1.cpp
test1.cpp:14: cannot convert `void (*)()' to `void (*)()' for argument
`1' to 
   `int atexit(void (*)())'
$ g++ -v
Reading specs from
/usr/local/opt/gcc/lib/gcc-lib/i686-pc-linux-gnu/2.97/specs
Configured with: ./src/configure --prefix=/usr/local/opt/gcc
--exec-prefix=/usr/local/opt/gcc --enable-shared --enable-threads
--enable-languages=c,c++
gcc version 2.97 20010102 (experimental)


   This file compiles just fine if you use the second definition of
m_func instead of the first one. That's why I say it's the placement of
__attribute__ that confuses g++.
   Also worth noting: it compiles fine with g++ 2.95.2 as delivered in
Debian (20000220).

   Should I make a bug report in GNATS? (the doc says 'What we DON'T
want: Bugs in releases or snapshots of GCC not issued by the GNU
Project.' which made me hesitate)


--
Francois Gouget         fgouget@free.fr        http://fgouget.free.fr/
                         Stolen from an Internet user:
              "f u cn rd ths, u cn gt a gd jb n cmptr prgrmmng !"



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