diff options
author | Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> | 2003-05-11 10:06:39 +0000 |
---|---|---|
committer | Kriang Lerdsuwanakij <lerdsuwa@gcc.gnu.org> | 2003-05-11 10:06:39 +0000 |
commit | 9f01ded6a4ccb23faa18ce19091eb5ea0408b8d9 (patch) | |
tree | 712300bb0224b77b61f835658679572e5ed34310 /gcc/cp/semantics.c | |
parent | fcea74011f2d59f310379d393799c353b7c54293 (diff) | |
download | gcc-9f01ded6a4ccb23faa18ce19091eb5ea0408b8d9.zip gcc-9f01ded6a4ccb23faa18ce19091eb5ea0408b8d9.tar.gz gcc-9f01ded6a4ccb23faa18ce19091eb5ea0408b8d9.tar.bz2 |
PR c++/10230, c++/10481
PR c++/10230, c++/10481
* semantics.c (finish_non_static_data_member): Handle when the
non-static member is not from a base of the current class type.
* g++.dg/lookup/scoped5.C: New test.
From-SVN: r66683
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 62a900a..ab6a75c 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1276,13 +1276,22 @@ finish_non_static_data_member (tree decl, tree qualifying_scope) tree access_type = current_class_type; tree object = current_class_ref; - while (!DERIVED_FROM_P (context_for_name_lookup (decl), access_type)) + while (access_type + && !DERIVED_FROM_P (context_for_name_lookup (decl), access_type)) { access_type = TYPE_CONTEXT (access_type); - while (DECL_P (access_type)) + while (access_type && DECL_P (access_type)) access_type = DECL_CONTEXT (access_type); } + if (!access_type) + { + cp_error_at ("object missing in reference to `%D'", + decl); + error ("from this location"); + return error_mark_node; + } + perform_or_defer_access_check (access_type, decl); /* If the data member was named `C::M', convert `*this' to `C' |