public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/13664] New: virtual in private base can be overridden in further-derived class
@ 2004-01-13  0:37 james_avera2 at yahoo dot com
  2004-01-13  0:37 ` [Bug c++/13664] " james_avera2 at yahoo dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: james_avera2 at yahoo dot com @ 2004-01-13  0:37 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/13664] virtual in private base can be overridden in further-derived class
  2004-01-13  0:37 [Bug c++/13664] New: virtual in private base can be overridden in further-derived class james_avera2 at yahoo dot com
@ 2004-01-13  0:37 ` james_avera2 at yahoo dot com
  2004-01-13  0:41 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: james_avera2 at yahoo dot com @ 2004-01-13  0:37 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From james_avera2 at yahoo dot com  2004-01-13 00:37 -------
Created an attachment (id=5468)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5468&action=view)
Test case


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/13664] virtual in private base can be overridden in further-derived class
  2004-01-13  0:37 [Bug c++/13664] New: virtual in private base can be overridden in further-derived class james_avera2 at yahoo dot com
  2004-01-13  0:37 ` [Bug c++/13664] " james_avera2 at yahoo dot com
@ 2004-01-13  0:41 ` pinskia at gcc dot gnu dot org
  2004-01-13 16:10 ` bangerth at dealii dot org
  2004-01-13 16:10 ` bangerth at dealii dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-13  0:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-13 00:41 -------
Confirmed for 3.2.3 but fixed for 3.3.1 at least.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
           Keywords|                            |accepts-invalid
         Resolution|                            |FIXED
   Target Milestone|---                         |3.3.1


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/13664] virtual in private base can be overridden in further-derived class
  2004-01-13  0:37 [Bug c++/13664] New: virtual in private base can be overridden in further-derived class james_avera2 at yahoo dot com
                   ` (2 preceding siblings ...)
  2004-01-13 16:10 ` bangerth at dealii dot org
@ 2004-01-13 16:10 ` bangerth at dealii dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bangerth at dealii dot org @ 2004-01-13 16:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-01-13 16:10 -------
...to close it as invalid. 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/13664] virtual in private base can be overridden in further-derived class
  2004-01-13  0:37 [Bug c++/13664] New: virtual in private base can be overridden in further-derived class james_avera2 at yahoo dot com
  2004-01-13  0:37 ` [Bug c++/13664] " james_avera2 at yahoo dot com
  2004-01-13  0:41 ` pinskia at gcc dot gnu dot org
@ 2004-01-13 16:10 ` bangerth at dealii dot org
  2004-01-13 16:10 ` bangerth at dealii dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bangerth at dealii dot org @ 2004-01-13 16:10 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-01-13 16:10 -------
The testcase is invalid but for other reasons. Overloading and access 
control are completely separate things. You can thus overload a function 
in the base class even if you can't access it. The error in 3.3 and 
3.4 is due to the fact that you try to take the address of base::i; 
overriding base::func by distant::func is still ok. 
 
I'll reopen the bug... 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|FIXED                       |


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-01-13 16:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-13  0:37 [Bug c++/13664] New: virtual in private base can be overridden in further-derived class james_avera2 at yahoo dot com
2004-01-13  0:37 ` [Bug c++/13664] " james_avera2 at yahoo dot com
2004-01-13  0:41 ` pinskia at gcc dot gnu dot org
2004-01-13 16:10 ` bangerth at dealii dot org
2004-01-13 16:10 ` bangerth at dealii dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).