This is the mail archive of the gcc-prs@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]

Re: c++/8500: Allows cast to private base class


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

From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/8500: Allows cast to private base class
Date: 11 Nov 2002 12:36:48 +0100

 Wolfgang Bangerth <bangerth@ticam.utexas.edu> writes:
 
 | The following reply was made to PR c++/8500; it has been noted by GNATS.
 | 
 | From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
 | To: "Harald H. Soleng" <Harald.Soleng@nr.no>
 | Cc: gcc-gnats@gcc.gnu.org
 | Subject: Re: c++/8500: Allows cast to private base class
 | Date: Fri, 8 Nov 2002 14:03:20 -0600 (CST)
 | 
 |  > You should not get an error with old style c-casting.
 |  > However, with 
 |  > 
 |  >         Base* b1 = static_cast<Base*> d1;
 |  > 
 |  > on the second line of main you should. Here is the error message from
 |  > the native Sun CC compiler:
 |  > "Error: Using static_cast to convert from Derived* to Base* not allowed."
 |  
 |  Uhm, I don't think you can work around access control rules just by using 
 |  a C-style cast over a static_cast, can you?
 
 old-style casts don't chech acess control.  New-style casts do, however.
 
 -- Gaby
 
 


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