From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11298 invoked by alias); 11 Sep 2003 14:06:30 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 11286 invoked by uid 48); 11 Sep 2003 14:06:29 -0000 Date: Thu, 11 Sep 2003 14:54:00 -0000 Message-ID: <20030911140629.11285.qmail@sources.redhat.com> From: "bangerth at dealii dot org" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20030911070034.12246.Bruce@Fitzsimons.org> References: <20030911070034.12246.Bruce@Fitzsimons.org> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/12246] __attribute__ not allowed in member function definition X-Bugzilla-Reason: CC X-SW-Source: 2003-09/txt/msg00889.txt.bz2 List-Id: PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12246 bangerth at dealii dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed| |1 Keywords| |diagnostic Last reconfirmed|0000-00-00 00:00:00 |2003-09-11 14:06:28 date| | Summary|__attribute__ not able to be|__attribute__ not allowed in |placed on inline ctors |member function definition ------- Additional Comments From bangerth at dealii dot org 2003-09-11 14:06 ------- Indeed, but this has nothing to do with constructors, as this example shows: ------------------------------------------------------ struct A { int f() __attribute__ ((deprecated)) {} }; int f() __attribute__ ((deprecated)) {} ------------------------------------------------------- Compiled with 3.3, we get mp/g> ~/bin/gcc-3.3/bin/c++ -c x.cc x.cc:2: error: parse error before `{' token x.cc:2: error: missing ';' before right brace x.cc:5: error: parse error before `{' token That's not very enlightening. Present mainline tells us more, at least for the non-member case: mp/g> c++ -c x.cc x.cc:2: error: expected function-definition x.cc:5: error: attributes are not allowed on a function-definition So the point is really that attributes are not allowed at function _definitions_ (though it's easy to check that they are of course allowed at _declarations_), but that this is only properly diagnosed for the non-member case. W. PS: A workaround for the original problem is this: -------------------- struct A { A() __attribute__ ((deprecated)); }; inline A::A () {} ---------------------