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] Derived protected types with discriminants


This patch handles derived protected types that have fewer discriminants than
the parent type. In this case the corresponding record of the derived type
must be a similar derivation of the corresponding record of the parent

The following must compile quietly:

package Der_Prot  is
   protected type Object( A, B: Positive )
   is
      entry Wait;
      procedure Send;
   private
     Name1 : String (1 .. A) := (others => '+');
     Name2 : String (1 .. B) := (others => '?');
   end Object;

   type Object2 (A, B : Positive) is new Object (B, A);

   type Object3( A : Positive ) is new Object ( A => A, B => 2);
end Der_Prot ;

package body Der_Prot is
   protected body Object
   is
      entry Wait when true is
      begin
         null;
      end Wait;

      procedure Send is
      begin
         null;
      end Send;
   end Object;
end Der_Prot;

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

2009-07-28  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch3.adb (Build_Derived_Concurrent_Type): Handle properly a
	derivation that renames some discriminants and constrain others.
	* exp_ch9.adb (Build_Protected_Subprogram_Call): If the type of the
	prefix is a derived untagged type, convert to the root type to conform
	to the signature of the protected operations.

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]