This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[C++] static_cast does not check for accessibility
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: [C++] static_cast does not check for accessibility
- From: Gabriel Dos_Reis <Gabriel dot Dos_Reis at sophia dot inria dot fr>
- Date: 09 Jun 1999 02:30:38 +0200
- Organization: I.N.R.I.A Sophia-Antipolis (France)
The following should be rejected but gcc-2.96 current CVS accepts it.
class A {];
class B : A {};
int main()
{
B b;
static_cast<A*>(&b); // ERROR
}
See 5.2.9/2 and 4.10/3.
-- Gaby