mirror of git://gcc.gnu.org/git/gcc.git
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:
parent
c6e3045ef5
commit
d1a284842a
|
|
@ -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>
|
2015-08-17 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
PR c++/66919
|
PR c++/66919
|
||||||
|
|
|
||||||
|
|
@ -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. */
|
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 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;
|
return 0;
|
||||||
|
|
||||||
access = access_in_type (derived, decl);
|
access = access_in_type (derived, decl);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ struct B : protected P
|
||||||
struct C : public P
|
struct C : public P
|
||||||
{
|
{
|
||||||
// C can access P's copy ctor, but can't convert b to const 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()
|
void foo()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
// PR c++/66957
|
||||||
|
|
||||||
|
class BaseClass {
|
||||||
|
protected:
|
||||||
|
static int x;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DerivedA : BaseClass { };
|
||||||
|
|
||||||
|
struct DerivedB : BaseClass {
|
||||||
|
DerivedB() {
|
||||||
|
(void) DerivedA::x;
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue