diff options
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r-- | gcc/ada/sem_res.adb | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 90a362c..4ad60a9 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -11799,7 +11799,12 @@ package body Sem_Res is -- after the return. elsif Is_Access_Subprogram_Type (Target_Type) - and then No (Corresponding_Remote_Type (Opnd_Type)) + + -- Note: this test of Ekind (Opnd_Type) is there to prevent entering + -- this branch in the case of a remote access to subprogram type, + -- which is internally represented as an E_Record_Type. + + and then Ekind (Opnd_Type) in Access_Kind then if Ekind (Base_Type (Opnd_Type)) = E_Anonymous_Access_Subprogram_Type and then Is_Entity_Name (Operand) @@ -11864,7 +11869,7 @@ package body Sem_Res is return True; - -- Remote subprogram access types + -- Remote access to subprogram types elsif Is_Remote_Access_To_Subprogram_Type (Target_Type) and then Is_Remote_Access_To_Subprogram_Type (Opnd_Type) @@ -11872,6 +11877,15 @@ package body Sem_Res is -- It is valid to convert from one RAS type to another provided -- that their specification statically match. + -- Note: at this point, remote access to subprogram types have been + -- expanded to their E_Record_Type representation, and we need to + -- go back to the original access type definition using the + -- Corresponding_Remote_Type attribute in order to check that the + -- designated profiles match. + + pragma Assert (Ekind (Target_Type) = E_Record_Type); + pragma Assert (Ekind (Opnd_Type) = E_Record_Type); + Check_Subtype_Conformant (New_Id => Designated_Type (Corresponding_Remote_Type (Target_Type)), |