aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-05-01 00:27:12 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-19 04:17:23 -0400
commit92392296c19de59d12558eedb9a5966a138454a7 (patch)
tree3129cef24e91809d8e6ba8899e7860099fb3ba1b /gcc
parentc5c69d05a905069496f81a3e2fe78ec85aa8dd36 (diff)
downloadgcc-92392296c19de59d12558eedb9a5966a138454a7.zip
gcc-92392296c19de59d12558eedb9a5966a138454a7.tar.gz
gcc-92392296c19de59d12558eedb9a5966a138454a7.tar.bz2
[Ada] Fix internal error on component of class-wide parameter in instance body
2020-06-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_ch4.adb (Analyze_Selected_Component): In an instance body, also invoke Find_Component_In_Instance on the parent subtype of a derived tagged type immediately visible. Remove obsolete case.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch4.adb24
1 files changed, 10 insertions, 14 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 0f59b40..58e8058 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -5268,25 +5268,21 @@ package body Sem_Ch4 is
end loop;
-- Another special case: the type is an extension of a private
- -- type T, is an actual in an instance, and we are in the body
- -- of the instance, so the generic body had a full view of the
- -- type declaration for T or of some ancestor that defines the
- -- component in question.
+ -- type T, either is an actual in an instance or is immediately
+ -- visible, and we are in the body of the instance, which means
+ -- the generic body had a full view of the type declaration for
+ -- T or some ancestor that defines the component in question.
+ -- This happens because Is_Visible_Component returned False on
+ -- this component, as T or the ancestor is still private since
+ -- the Has_Private_View mechanism is bypassed because T or the
+ -- ancestor is not directly referenced in the generic body.
elsif Is_Derived_Type (Type_To_Use)
- and then Used_As_Generic_Actual (Type_To_Use)
+ and then (Used_As_Generic_Actual (Type_To_Use)
+ or else Is_Immediately_Visible (Type_To_Use))
and then In_Instance_Body
then
Find_Component_In_Instance (Parent_Subtype (Type_To_Use));
-
- -- In ASIS mode the generic parent type may be absent. Examine
- -- the parent type directly for a component that may have been
- -- visible in a parent generic unit.
- -- ??? Revisit now that ASIS mode is gone
-
- elsif Is_Derived_Type (Prefix_Type) then
- Par := Etype (Prefix_Type);
- Find_Component_In_Instance (Par);
end if;
end;