diff options
Diffstat (limited to 'gcc/ada/sem_res.adb')
-rw-r--r-- | gcc/ada/sem_res.adb | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 56b6aee..6861f1a 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -2156,20 +2156,6 @@ package body Sem_Res is -- First matching interpretation if not Found then - -- If the current statement is part of a predefined library - -- unit, then all interpretations which come from user level - -- packages should not be considered. User-defined operators - -- may appear anywhere in the homonym list. This exclusion - -- does not apply in an instance, where an actual may come - -- from a local declaration. - - if From_Lib - and then not Comes_From_Predefined_Lib_Unit (It.Nam) - and then not In_Instance - then - goto Continue; - end if; - Found := True; I1 := I; Seen := It.Nam; @@ -2181,12 +2167,29 @@ package body Sem_Res is -- some more obscure cases are handled in Disambiguate. else - if From_Lib - and then not Comes_From_Predefined_Lib_Unit (It.Nam) - then - goto Continue; + -- If the current statement is part of a predefined library + -- unit, then all interpretations which come from user level + -- packages should not be considered. Check previous and + -- current one. + + if From_Lib then + if not Comes_From_Predefined_Lib_Unit (It.Nam) then + goto Continue; + + elsif not Comes_From_Predefined_Lib_Unit (Seen) then + + -- Previous interpretation must be discarded. + + I1 := I; + Seen := It.Nam; + Expr_Type := It.Typ; + Set_Entity (N, Seen); + goto Continue; + end if; end if; + -- Otherwise apply further disambiguation steps. + Error_Msg_Sloc := Sloc (Seen); It1 := Disambiguate (N, I1, I, Typ); |