From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22556 invoked by alias); 12 Jul 2005 21:51:46 -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 22545 invoked by uid 22791); 12 Jul 2005 21:51:42 -0000 Received: from wproxy.gmail.com (HELO wproxy.gmail.com) (64.233.184.194) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 12 Jul 2005 21:51:42 +0000 Received: by wproxy.gmail.com with SMTP id i22so41259wra for ; Tue, 12 Jul 2005 14:51:41 -0700 (PDT) Received: by 10.54.122.18 with SMTP id u18mr86231wrc; Tue, 12 Jul 2005 14:51:40 -0700 (PDT) Received: by 10.54.72.9 with HTTP; Tue, 12 Jul 2005 14:51:40 -0700 (PDT) Message-ID: <2e393d0805071214511077e14b@mail.gmail.com> Date: Tue, 12 Jul 2005 21:51:00 -0000 From: corey taylor Reply-To: corey taylor To: Paul Dubuc Subject: Re: Use of pointer to protected member function won't compile in 3.4.4 Cc: gcc-help@gcc.gnu.org In-Reply-To: <42D43A2E.4060700@cas.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <42D43A2E.4060700@cas.org> X-SW-Source: 2005-07/txt/msg00123.txt.bz2 This has been changed since 3.4.0 and is noted in the last bullet of the C++ changes: http://gcc.gnu.org/gcc-3.4/changes.html corey On 7/12/05, Paul Dubuc wrote: > This code will compile with g++ 3.3.4, but 3.4.4 gives me the following e= rror: >=20 > Test.cc: In member function `const char* Derived::getCharge() const': > Test.cc:18: error: `char* Base::makeCharge_(const char*) const' is protec= ted > Test.cc:31: error: within this context >=20 > Why can't the Derived class use a pointer to it's Base class' protected m= ember > function? Is this a bug in 3.4.4, or is this no longer allowed? >=20 > Help! >=20 > Here's the code: >=20 > class Base { >=20 > protected: >=20 > const char * getAttr_(unsigned char type, > char * (Base::*pf)(const char *) const) const; >=20 > char * makeCharge_(const char *) const; > }; >=20 > const char * Base::getAttr_(unsigned char type, > char * (Base::*pf)(const char *) const) const > { > return 0; > } >=20 > char * Base::makeCharge_(const char * ptr) const > { > return 0; > } >=20 > class Derived : public Base { >=20 > public: >=20 > const char * getCharge() const; > }; >=20 > const char * Derived::getCharge() const > { > return(getAttr_(0, &Base::makeCharge_)); > } >=20 >=20 > -- > Paul M. Dubuc >=20 > "It is not enough to do your best; you must know what to do, and THEN do = your > best." -- W. Edwards Deming >