This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] improve handling of formal parameters


Tested on i686-linux, committed on mainline.

A formal parameter can be denoted either by an identifier, or by an expanded
name (subprogram_name.formal). When looking for the formal entity denoted
by a node, both cases need to be taken into account (previously we
treated only the identifier case).
-- Test case:
The following program must yield the following output:
Expected: FALSE
X'Constrained =  FALSE
P.X'Constrained =  FALSE
Expected: TRUE
X'Constrained =  TRUE
P.X'Constrained =  TRUE
--  Source code follows
with Ada.Text_IO; use Ada.Text_IO;
procedure Toto is
   type R (D : Boolean := False) is null record;
   procedure P (X : out R; Constrained : Boolean) is
   begin
      Put_Line ("Expected: " & Constrained'Img);
      Put_Line ("X'Constrained =  " & Boolean'Image (X'Constrained));
      Put_Line ("P.X'Constrained =  " & Boolean'Image (P.X'Constrained));
   end P;
   U : R;
   C : R (True);
begin
   P (U, False);
   P (C, True);
end Toto;

2005-06-14  Thomas Quinot  <quinot@adacore.com>

	* exp_ch2.adb (Param_Entity): Take the case of an expanded_name
	denoting a formal parameter into account.

Attachment: difs.21
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]