This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
The placement of __attribute__ confuses g++
- To: gcc at gcc dot gnu dot org
- Subject: The placement of __attribute__ confuses g++
- From: Francois Gouget <fgouget at free dot fr>
- Date: Sat, 6 Jan 2001 09:06:25 -0800 (PST)
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).
I posted this mail on gcc-bugs before but it got lost in the noise.
Or maybe it was the wrong place and it got ignored which is why I'm
retrying here.
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 !"