This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12265] New: Downcast to class which derives privately rejected


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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]