This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12265] New: Downcast to class which derives privately rejected
- From: "olau at hardworking dot dk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Sep 2003 16:35:05 -0000
- Subject: [Bug c++/12265] New: Downcast to class which derives privately rejected
- 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=12265
Summary: Downcast to class which derives privately rejected
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: olau at hardworking dot dk
CC: gcc-bugs at gcc dot gnu dot org
Given the source
class Base {
public:
int x;
void f();
};
class Derived: private Base { };
void Base::f()
{
static_cast<const Derived&>(*this);
}
GCC says
$ g++ t1.c++ -o t1 -Wall
t1.c++: I member function 'void Base::f()':
t1.c++:11: error: `Base' is an inaccessible base of `Derived'
But as far as I know, that code is legal (I may be wrong). The C++ wrapper of
GTK+, gtkmm, uses such code and now doesn't work. Previous releases of GCC were
fine. The precise version of GCC is:
$ gcc-3.3 --version
gcc-3.3 (GCC) 3.3.2 20030908 (Debian prerelease)