This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/23849] inaccessible base in static_cast from template base type to non-template derived type
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Sep 2005 14:04:27 -0000
- Subject: [Bug c++/23849] inaccessible base in static_cast from template base type to non-template derived type
- References: <20050913074438.23849.fang@csl.cornell.edu>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2005-09-13 14:04 -------
Here's a slightly smaller version:
-----------------
struct A {};
struct B : private A {};
B *p = static_cast<B*>((A*)0);
-----------------
g/x> /home/bangerth/bin/gcc-3.2.3/bin/c++ -c x.cc
g/x> /home/bangerth/bin/gcc-3.4*/bin/c++ -c x.cc
x.cc:4: error: `A' is an inaccessible base of `B'
The code is rejected at least since gcc3.3.4pre. I must admit that I don't
know right away whether the code is legal -- icc for one accepts it -- though
I could think of arguments why it shouldn't be.
W.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23849