summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch4.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-10 13:55:59 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-10 13:55:59 +0000
commitd5de5c859c0b7c6fe4aa594b88db212ca9d46f51 (patch)
tree84dd53df6d99da6a0a0aa0fe0a8c759e21953676 /gcc/ada/sem_ch4.adb
parent7c842184743b324e0a9ccae64019794dd91f4a93 (diff)
downloadgcc-d5de5c859c0b7c6fe4aa594b88db212ca9d46f51.tar.gz
* sem_ch4.adb (Analyze_Selected_Component): Create Actual_Subtype even
with expansion disabled. The actual subtype is needed among other places when the selected component appears in the context of a loop bound, and denotes a packed array. (Operator_Check): Always use the first subtype in the error message, to avoid the appearance of internal base types. (Transform_Object_Operation): Copy each actual in full to the parameter associations of the constructed call, rather than using the shallow copy mechanism of New_Copy_List. This ensures that the chaining of named associations is done properly. (Complete_Object_Operation): Rewrite node, rather than replacing it, so that we can trace back to the original selected component. * sem_elab.adb (Set_Elaboration_Constraint): For initialization calls, and calls that use object notation, if the called function is not declared in a withed unit, place the elaboration constraint on the unit in the context that makes the function accessible. (Check_Elab_Subtype_Declaration): Check whether a subtype declaration imposes an elaboration constraint between two packages. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94820 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r--gcc/ada/sem_ch4.adb29
1 files changed, 17 insertions, 12 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 417c8c7c490..17d9993f329 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2004, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -2650,10 +2650,7 @@ package body Sem_Ch4 is
-- not make an actual subtype, we end up getting a direct
-- reference to a discriminant which will not do.
- -- Comment needs revision, "in all other cases" does not
- -- reasonably describe the situation below with an elsif???
-
- elsif Expander_Active then
+ else
Act_Decl :=
Build_Actual_Subtype_Of_Component (Etype (Comp), N);
Insert_Action (N, Act_Decl);
@@ -2675,9 +2672,6 @@ package body Sem_Ch4 is
Set_Etype (N, Subt);
end;
end if;
-
- else
- Set_Etype (N, Etype (Comp));
end if;
return;
@@ -4400,7 +4394,7 @@ package body Sem_Ch4 is
and then not Is_Overloaded (R)
and then Base_Type (Etype (L)) = Base_Type (Etype (R))
then
- Error_Msg_Node_2 := Etype (R);
+ Error_Msg_Node_2 := First_Subtype (Etype (R));
Error_Msg_N ("there is no applicable operator& for}", N);
else
@@ -4799,7 +4793,7 @@ package body Sem_Ch4 is
begin
Set_Name (Call_Node, New_Copy_Tree (Subprog));
Set_Analyzed (Call_Node, False);
- Replace (Node_To_Replace, Call_Node);
+ Rewrite (Node_To_Replace, Call_Node);
Analyze (Node_To_Replace);
end Complete_Object_Operation;
@@ -4830,8 +4824,19 @@ package body Sem_Ch4 is
then
Node_To_Replace := Parent_Node;
- Append_List_To (Actuals,
- New_Copy_List (Parameter_Associations (Parent_Node)));
+ -- Copy list of actuals in full before attempting to resolve call.
+ -- This is necessary to ensure that the chaining of named actuals
+ -- that happens during matching is done on a separate copy.
+
+ declare
+ Actual : Node_Id;
+ begin
+ Actual := First (Parameter_Associations (Parent_Node));
+ while Present (Actual) loop
+ Append (New_Copy_Tree (Actual), Actuals);
+ Next (Actual);
+ end loop;
+ end;
if Nkind (Parent_Node) = N_Procedure_Call_Statement then
Call_Node :=