From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18212 invoked by alias); 8 Jan 2003 10:25:23 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 17630 invoked from network); 8 Jan 2003 10:24:03 -0000 Received: from unknown (HELO smtp3.vol.cz) (195.250.128.83) by 209.249.29.67 with SMTP; 8 Jan 2003 10:24:03 -0000 Received: from wintermute (prahae-5-60.dialup.vol.cz [62.177.75.192]) by smtp3.vol.cz (8.12.6/8.12.6) with ESMTP id h08ANoow054402 for ; Wed, 8 Jan 2003 11:23:51 +0100 (CET) (envelope-from vaclav.slavik@matfyz.cz) Content-Type: text/plain; charset="us-ascii" From: Vaclav Slavik To: gcc-help@gcc.gnu.org Subject: __attribute__((deprecated)) and inline constructors Date: Wed, 08 Jan 2003 10:25:00 -0000 User-Agent: KMail/1.4.3 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200301080059.43059.vaclav.slavik@matfyz.cz> X-SW-Source: 2003-01/txt/msg00064.txt.bz2 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I'm having some problems with gcc 3.2 and __attribute__((deprecated))=20 when used in combination with inline functions. I need to add the=20 attribute to quite a few methods in several classes. These deprecated=20 methods are implemented inline, as in this example: class X { public: X() {} void foo() {} }; But this doesn't compile ("parse error before `{' token"): class X { public: X() __attribute__((deprecated)) {} void foo() __attribute__((deprecated)) {} }; I found that this works: class X { public: __attribute__((deprecated)) void foo() {} }; but I didn't find such use of __attribute__ in gcc documentation, so=20 I'm not sure it will continue to work in future gcc versions. More=20 importantly, it doesn't work with constructors, this doesn't compile: class X { public: __attribute__((deprecated)) X() {} }; The only working solution I found so far is to move the implementation=20 outside of class { ... } statement: class X { public: X() __attribute__((deprecated)); void foo() __attribute__((deprecated)); }; inline X::X() {} inline void X::foo() {} But I'd like to avoid it if possible both because of the amount of=20 deprecated methods and because inline implementation at the line=20 pointed to by gcc warning serves as a hint how to fix code that uses=20 deprecated calls. Is there some way to do what I'm trying to? Thanks! Vaclav Slavik - --=20 PGP key: http://pgp.mit.edu:11371/pks/lookup?op=3Dget&search=3D0x465264C9 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+G2nvxDYa/UZSZMkRAjrLAJ94hkAt63hY+6BxucfJfUbfXgHkJACfeqD1 jwp7Hw4IZxV6HPFnZw/pgGU=3D =3D7lhH -----END PGP SIGNATURE-----