This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12119] New: Inherited protected member not accessible.
- From: "richard dot kreckel at ginac dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Aug 2003 21:44:04 -0000
- Subject: [Bug c++/12119] New: Inherited protected member not accessible.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12119
Summary: Inherited protected member not accessible.
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: richard dot kreckel at ginac dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
The following does not compile under GCC-3.4-20030827. It used to compile
with GCC-3.3. The code was distilled from a library attempting to implement
multiple dispatch manually via templates.
class dispatcher {
public:
template <class T>
dispatcher& notice(void (T::*f)(void));
};
class A {
protected:
void do_onething() const;
private:
static dispatcher reginfo;
};
dispatcher A::reginfo = dispatcher().notice(&A::do_onething);
class B : public A {
protected:
void do_otherthing() const;
private:
static dispatcher reginfo;
};
dispatcher B::reginfo = dispatcher().notice(&A::do_onething);
Compiling above snippet yields:
$ c++ -c dispatcher.cpp
dispatcher.cpp:9: error: `void A::do_onething() const' is protected
dispatcher.cpp:24: error: within this context
Notice, that changing the last line to
dispatcher B::reginfo = dispatcher().notice(&B::do_otherthing);
makes it compile, so this is obviously a bug in GCC.
Regards
-richy.
--
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>