summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_util.adb
diff options
context:
space:
mode:
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>2017-10-09 15:49:59 +0000
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>2017-10-09 15:49:59 +0000
commit9a66624166fe389f6a11bf68e0a709dcfb81ee53 (patch)
tree502d3d4524dac42d6f46e6e143c46c1c92fa6ac8 /gcc/ada/sem_util.adb
parent026dbb2e800ff0e71017cade9c4053d0c5d48513 (diff)
downloadgcc-9a66624166fe389f6a11bf68e0a709dcfb81ee53.tar.gz
gcc/ada/
2017-10-09 Bob Duff <duff@adacore.com> * exp_ch6.adb: (Make_Build_In_Place_Call_In_Object_Declaration): Remove the code at the end of this procedure that was setting the type of a class-wide object to the specific type returned by a function call. Treat this case as indefinite instead. 2017-10-09 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Try_Class_Wide_Operation, Traverse_Homonyms): Suppress spurious ambiguity error when two traversals of the homonym chain (first directly, and then through an examination of relevant interfaces) retrieve the same operation, when other irrelevant homonyms of the operatioh are also present. 2017-10-09 Ed Schonberg <schonberg@adacore.com> * sem_util.adb (Object_Access_Level): If the object is the return statement of an expression function, return the level of the function. This is relevant when the object involves an implicit conversion between access types and the expression function is a completion, which forces the analysis of the expression before rewriting it as a body, so that freeze nodes can appear in the proper scope. 2017-10-09 Bob Duff <duff@adacore.com> * atree.adb: Make nnd apply to everything "interesting", including Rewrite. Remove rrd. 2017-10-09 Javier Miranda <miranda@adacore.com> * exp_ch3.adb (Expand_N_Object_Declaration): Avoid never-ending loop processing the declaration of the dummy object internally created by Make_DT to compute the offset to the top of components referencing secondary dispatch tables. (Initialize_Tag): Do not initialize the offset-to-top field if it has been initialized initialized. * exp_disp.ads (Building_Static_Secondary_DT): New subprogram. * exp_disp.adb (Building_Static_Secondary_DT): New subprogram. (Make_DT): Create a dummy constant object if we can statically build secondary dispatch tables. (Make_Secondary_DT): For statically allocated secondary dispatch tables use the dummy object to compute the offset-to-top field value by means of the attribute 'Position. gcc/testsuite/ 2017-10-09 Ed Schonberg <schonberg@adacore.com> * gnat.dg/class_wide3.adb, gnat.dg/class_wide3_pkg.ads: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253550 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_util.adb')
-rw-r--r--gcc/ada/sem_util.adb11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 60df83840f7..42063827760 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -20383,6 +20383,17 @@ package body Sem_Util is
(Nearest_Dynamic_Scope
(Defining_Entity (Node_Par)));
+ -- For a return statement within a function, return
+ -- the depth of the function itself. This is not just
+ -- a small optimization, but matters when analyzing
+ -- the expression in an expression function before
+ -- the body is created.
+
+ when N_Simple_Return_Statement =>
+ if Ekind (Current_Scope) = E_Function then
+ return Scope_Depth (Current_Scope);
+ end if;
+
when others =>
null;
end case;