aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/semantics.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index e586126..5ab2076 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -2516,9 +2516,14 @@ check_accessibility_of_qualified_id (tree decl,
OBJECT_TYPE. */
&& CLASS_TYPE_P (object_type)
&& DERIVED_FROM_P (scope, object_type))
- /* If we are processing a `->' or `.' expression, use the type of the
- left-hand side. */
- qualifying_type = object_type;
+ {
+ /* If we are processing a `->' or `.' expression, use the type of the
+ left-hand side. */
+ if (tree open = currently_open_class (object_type))
+ qualifying_type = open;
+ else
+ qualifying_type = object_type;
+ }
else if (nested_name_specifier)
{
/* If the reference is to a non-static member of the