diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2020-05-01 00:27:12 +0200 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 13:14:10 -0300 |
commit | 27c714f9a70d37ccf3e2ba19f1bb65dc8ca004fa (patch) | |
tree | 6d35c21f114228979ae2a53676f1ab8f8f4a68f7 | |
parent | 919f132d904f090b5ac0b66c33359a01bf5932b8 (diff) | |
download | gcc-27c714f9a70d37ccf3e2ba19f1bb65dc8ca004fa.zip gcc-27c714f9a70d37ccf3e2ba19f1bb65dc8ca004fa.tar.gz gcc-27c714f9a70d37ccf3e2ba19f1bb65dc8ca004fa.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.
-rw-r--r-- | gcc/ada/sem_ch4.adb | 24 |
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; |