re PR c++/66957 (incorrect "is protected within this context" error)

PR c++/66957
	* search.c (protected_accessible_p): Revert fix for 38579.

From-SVN: r226975
This commit is contained in:
Jason Merrill 2015-08-18 10:44:06 -04:00 committed by Jason Merrill
parent c6e3045ef5
commit d1a284842a
4 changed files with 21 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2015-08-17 Jason Merrill <jason@redhat.com>
PR c++/66957
* search.c (protected_accessible_p): Revert fix for 38579.
2015-08-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/66919

View File

@ -736,7 +736,7 @@ protected_accessible_p (tree decl, tree derived, tree binfo)
Here DERIVED is a possible P, DECL is m and BINFO_TYPE (binfo) is N. */
/* If DERIVED isn't derived from N, then it can't be a P. */
if (!DERIVED_FROM_P (BINFO_TYPE (binfo), derived))
if (!DERIVED_FROM_P (context_for_name_lookup (decl), derived))
return 0;
access = access_in_type (derived, decl);

View File

@ -15,7 +15,7 @@ struct B : protected P
struct C : public P
{
// C can access P's copy ctor, but can't convert b to const P&.
C(const B& b) : P(b) {} // { dg-error "inaccessible base" }
C(const B& b) : P(b) {} // { dg-error "inaccessible base" "" { xfail *-*-* } }
};
void foo()

View File

@ -0,0 +1,14 @@
// PR c++/66957
class BaseClass {
protected:
static int x;
};
struct DerivedA : BaseClass { };
struct DerivedB : BaseClass {
DerivedB() {
(void) DerivedA::x;
}
};