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] Missing errors in the body of a protected function


In the body of a protected function, the protected object itself is a constant
(not just its components).

Compiling p.adb must yield:

   p.adb:12:20: actual for "It" must be a variable
   p.adb:18:17: actual for "It" must be a variable

procedure P is
   protected type Prot is
      function F return integer;
   private
      buffer : String (1 .. 100);
   end;
   procedure Stack_it (It : in out Prot) is begin null; end;

   protected body Prot is
      function F return integer is
      begin
         Stack_it (prot);  -- ERROR
         return 15;
      end;
   end Prot;
   procedure Wrapper (It : Prot) is
   begin
      Stack_It (It);  -- ERROR
   end;
begin
   null;
end;

Tested on x86_64-pc-linux-gnu, committed on trunk

2013-10-14  Ed Schonberg  <schonberg@adacore.com>

	* sem_util.adb (Is_Variable, In_Protected_Function):  In the
	body of a protected function, the protected object itself is a
	constant (not just its components).

Attachment: difs
Description: Text document


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