diff options
Diffstat (limited to 'gcc/ada/exp_disp.adb')
-rw-r--r-- | gcc/ada/exp_disp.adb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/ada/exp_disp.adb b/gcc/ada/exp_disp.adb index 99575141cfa..66ab8134622 100644 --- a/gcc/ada/exp_disp.adb +++ b/gcc/ada/exp_disp.adb @@ -1533,20 +1533,22 @@ package body Exp_Disp is Formal := First (Formals); while Present (Formal) loop - -- Handle concurrent types + -- If the parent is a constrained discriminated type, then the + -- primitive operation will have been defined on a first subtype. + -- For proper matching with controlling type, use base type. if Ekind (Target_Formal) = E_In_Parameter and then Ekind (Etype (Target_Formal)) = E_Anonymous_Access_Type then - Ftyp := Directly_Designated_Type (Etype (Target_Formal)); + Ftyp := + Base_Type (Directly_Designated_Type (Etype (Target_Formal))); else - -- If the parent is a constrained discriminated type, then the - -- primitive operation will have been defined on a first subtype. - -- For proper matching with controlling type, use base type. - Ftyp := Base_Type (Etype (Target_Formal)); end if; + -- For concurrent types, the relevant info is on the corresponding_ + -- record type. + if Is_Concurrent_Type (Ftyp) then Ftyp := Corresponding_Record_Type (Ftyp); end if; |