Surprising behavior of __attribute__((deprecated)) in ctor

Mathieu Malaterre mmalater@nycap.rr.com
Sun Jul 24 00:42:00 GMT 2005


Hello,

	I have quite a surpising behavior with gcc when compiling the following 
code (*). Here is the output:

$ g++ deprecated.cxx                                       /tmp
deprecated.cxx: In constructor `A::A(int)':
deprecated.cxx:11: warning: `A' is deprecated (declared at deprecated.cxx:9)
deprecated.cxx: In constructor `A::A(int)':
deprecated.cxx:11: warning: `A' is deprecated (declared at deprecated.cxx:9)

Using:
$ g++ --version
g++ (GCC) 3.3 20030304 (Apple Computer, Inc. build 1671)

I cannot reproduce that with gcc 3.3, 3.4, 4.0 on my linux box (debian 
testing package).

Comment ?

Thanks,
Mathieu
Ps: function seems fine.


(*)
-------- deprecated.cxx ------
class A
{
public:
   A() { foo=0; };
   A(int b) __attribute__((deprecated));
   int foo;
};
A::A(int b)
{
   foo = b;
}

int main()
{
   A a;
   // A a(2);
}



More information about the Gcc mailing list