diff options
author | Jason Merrill <jason@gcc.gnu.org> | 2002-04-09 09:59:59 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2002-04-09 09:59:59 -0400 |
commit | cd6af0c13a345daa0d71484864072b26363d0523 (patch) | |
tree | 2f8e28107bdafe8a62d41c53b8bfceac8d8d4d32 | |
parent | 1ce7f3c2ab0b622ec93be5bc39c3d4efa7fbef5f (diff) | |
download | gcc-cd6af0c13a345daa0d71484864072b26363d0523.zip gcc-cd6af0c13a345daa0d71484864072b26363d0523.tar.gz gcc-cd6af0c13a345daa0d71484864072b26363d0523.tar.bz2 |
init.c (build_member_call): For now, don't convert to intermediate base if it would cause an error.
* init.c (build_member_call): For now, don't convert to
intermediate base if it would cause an error.
From-SVN: r52078
-rw-r--r-- | gcc/cp/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/cp/init.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/scoped1.C | 22 |
3 files changed, 34 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 940afa0..c0477bd 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2002-04-09 Jason Merrill <jason@redhat.com> + + * init.c (build_member_call): For now, don't convert to + intermediate base if it would cause an error. + 2002-04-08 Paolo Carlini <pcarlini@unitus.it> * parse.y (namespace_qualifier, maybe_identifier, @@ -276,8 +281,8 @@ 2002-03-22 Jeff Knaggs <jknaggs@redhat.com> - * typeck.c (expand_ptrmemfunc_cst): Scale idx down to an index - into the vtable_entry array regardless of + * typeck.c (get_member_function_from_ptrfunc): Scale idx down to + an index into the vtable_entry array regardless of TARGET_PTRMEMFUNC_VBIT_LOCATION. 2002-03-21 Aldy Hernandez <aldyh@redhat.com> diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 5caa69c..2143af4 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1497,7 +1497,11 @@ build_member_call (type, name, parmlist) /* Convert 'this' to the specified type to disambiguate conversion to the function's context. */ - if (decl == current_class_ref) + if (decl == current_class_ref + /* ??? this is wrong, but if this conversion is invalid we need to + defer it until we know whether we are calling a static or + non-static member function. Be conservative for now. */ + && ACCESSIBLY_UNIQUELY_DERIVED_P (type, current_class_type)) { basetype_path = NULL_TREE; decl = build_scoped_ref (decl, type, &basetype_path); diff --git a/gcc/testsuite/g++.dg/lookup/scoped1.C b/gcc/testsuite/g++.dg/lookup/scoped1.C new file mode 100644 index 0000000..0fe8d33 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/scoped1.C @@ -0,0 +1,22 @@ +// Test that explicitly scoped references to static members work even if +// they belong to an inaccessible base. + +struct A +{ + static int i1; + int i2; + static void f1 (); + void f2 (); +}; + +struct B: private A { }; +struct C: public B +{ + void g () + { + ::A::i1 = 1; + ::A::i2 = 1; // { dg-error "access" "" } + ::A::f1 (); + ::A::f2 (); // { dg-error "access" "" { xfail *-*-* } } + } +}; |