From d5c65b8050287f383302873bdd8759925a49c844 Mon Sep 17 00:00:00 2001 From: charlet Date: Fri, 13 Nov 2015 13:14:44 +0000 Subject: 2015-11-13 Eric Botcazou * sigtramp-ios.c, init.c: Minor cosmetic tweaks. 2015-11-13 Hristian Kirtchev * s-gloloc.adb, g-debpoo.adb: Minor reformatting. 2015-11-13 Ed Schonberg * sem_ch5.adb (Analyze_Iterator_Specification): Improve error message for the case the iterable name (array or container) is a component that depends on a discriminant. 2015-11-13 Ed Schonberg * sem_ch4.adb (Indicate_Name_And_Type): If the analysis of one interpretation succeeds, set type of name in call, for completeness. (Try_Container_Indexing): If there are multiple indexing functions, collect possible interpretations that are compatible with given parameters, and add implicit dereference types when present. * sem_util.adb (Build_Explicit_Dereference): If the expression is an overloaded function call use the given discriminant to resolve the call, and set properly the type of the call and of the resulting dereference. 2015-11-13 Hristian Kirtchev * sem_prag.adb (Analyze_Pragma): Pragma Constant_After_Elaboration can now apply to a variable without an initialization expression. 2015-11-13 Hristian Kirtchev * exp_ch9.adb (Add_Matching_Formals): Parameter Actuals is now of mode IN OUT. Create a new list when list Actuals is not present. (Build_Contract_Wrapper): Create the wrapper only when the entry has at least on checked contract case or pre/postcondition. Ensure that the call to the original entry lacks an actual parameter list when the entry appears without formal parameters. (Expand_Entry_Declaration): Code cleanup. 2015-11-13 Hristian Kirtchev * sem_ch13.adb (Analyze_Aspect_Specifications): Continue the analysis after encountering an illegal aspect Part_Of. 2015-11-13 Ed Schonberg * exp_attr.adb (Expand_N_Attribute_Reference, case Overlaps_Storage): Add copies for nodes that represent the integer addresses of the two actuals, to prevent identical nodes in the tree, which the backend cannot handle properly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230316 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/sem_util.adb | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'gcc/ada/sem_util.adb') diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 36dfc4df22f..712d03d258d 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -1732,6 +1732,8 @@ package body Sem_Util is Disc : Entity_Id) is Loc : constant Source_Ptr := Sloc (Expr); + I : Interp_Index; + It : Interp; begin -- An entity of a type with a reference aspect is overloaded with @@ -1744,6 +1746,29 @@ package body Sem_Util is Set_Etype (Expr, Etype (Entity (Expr))); elsif Nkind (Expr) = N_Function_Call then + + -- If the name of the indexing function is overloaded, locate the one + -- whose return type has an implicit dereference on the desired + -- discriminant, and set entity and type of function call. + + if Is_Overloaded (Name (Expr)) then + Get_First_Interp (Name (Expr), I, It); + + while Present (It.Nam) loop + if Ekind ((It.Typ)) = E_Record_Type + and then First_Entity ((It.Typ)) = Disc + then + Set_Entity (Name (Expr), It.Nam); + Set_Etype (Name (Expr), Etype (It.Nam)); + exit; + end if; + + Get_Next_Interp (I, It); + end loop; + end if; + + -- Set type of call from resolved function name. + Set_Etype (Expr, Etype (Name (Expr))); end if; -- cgit v1.2.1