This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/8500: Allows cast to private base class
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: nobody at gcc dot gnu dot org
- Cc: gcc-prs at gcc dot gnu dot org,
- Date: 11 Nov 2002 12:16:04 -0000
- Subject: Re: c++/8500: Allows cast to private base class
- Reply-to: Gabriel Dos Reis <gdr at integrable-solutions dot net>
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