public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/2330: static_cast<>() to a private base is allowed
@ 2001-03-20 10:26 philippeb
  0 siblings, 0 replies; 2+ messages in thread
From: philippeb @ 2001-03-20 10:26 UTC (permalink / raw)
  To: gcc-gnats

>Number:         2330
>Category:       c++
>Synopsis:       static_cast<>() to a private base is allowed
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 20 10:26:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     gcc
>Release:        2.95.3
>Organization:
>Environment:
Debian Linux (Woody) on Intel
>Description:
static_cast<>() from a derived type to its private base is 
allowed, but shouldn't. dynamic_cast<>() is okay on its side.
>How-To-Repeat:
#include <iostream>

struct A
{
    void foo() { std::cout << __PRETTY_FUNCTION__ << std::endl; }
};

struct B : private A
{
};

int main()
{
    B b;
    static_cast<A &>(b).foo();
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/2330: static_cast<>() to a private base is allowed
@ 2002-11-08  7:06 Wolfgang Bangerth
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Bangerth @ 2002-11-08  7:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/2330; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/2330: static_cast<>() to a private base is allowed
Date: Fri, 8 Nov 2002 09:07:23 -0600 (CST)

 This problem persists. It also appears with a C-style cast like 
 (Base*)derived_object, see PR 8500.
 
 W.
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 


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

end of thread, other threads:[~2002-11-08 15:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-03-20 10:26 c++/2330: static_cast<>() to a private base is allowed philippeb
2002-11-08  7:06 Wolfgang Bangerth

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).