This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH to lookup_base_r
- From: Jason Merrill <jason at redhat dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 28 Feb 2002 15:21:26 +0000
- Subject: PATCH to lookup_base_r
A class only has special rights to itself, not to any derived classes.
Fixes g++.dg/inherit/access2.C, a regression from 3.0.x.
Tested i686-pc-linux-gnu, applied to trunk and 3.1 branch.
2002-02-28 Jason Merrill <jason@redhat.com>
* search.c (lookup_base_r): Don't clear is_non_public just because
we found a friendly scope.
*** search.c.~1~ Fri Feb 1 13:12:18 2002
--- search.c Thu Feb 28 13:48:49 2002
*************** lookup_base_r (binfo, base, access, with
*** 201,208 ****
&& !within_current_scope
&& is_friend (BINFO_TYPE (binfo), current_scope ()))
{
within_current_scope = 1;
- is_non_public = 0;
}
if (same_type_p (BINFO_TYPE (binfo), base))
--- 201,209 ----
&& !within_current_scope
&& is_friend (BINFO_TYPE (binfo), current_scope ()))
{
+ /* Do not clear is_non_public here. If A is a private base of B, A
+ is not allowed to convert a B* to an A*. */
within_current_scope = 1;
}
if (same_type_p (BINFO_TYPE (binfo), base))