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++/13664] New: virtual in private base can be overridden in further-derived class


In gcc 3.2.3 (linux) a virtual method in a distant private base can be
over-ridden.  Since the base is private to the intermediate class, its 
fields should be invisible to further-derived classes.

I guess I'm not *certain* this is a bug, but the argument goes like this:

   Since the base is private, it should be completely opaque to
   further-derived classes; in particular, further-derived classes should not
   have their namespace polluted, nor should their methods accidentally
   override methods of the private base of the intermediate base.

In fact, gcc 3.2.2 (linux) does allow a further-derived class to override
virtuals in a private base of an intermediate base.  It should either
treat them as independent methods or disallow re-use of the same name.

I'll attach a demo program.

-- 
           Summary: virtual in private base can be overridden in further-
                    derived class
           Product: gcc
           Version: 3.2.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: james_avera2 at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13664


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