OSDN Git Service

2004-10-26 Ed Schonberg <schonberg@gnat.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 Oct 2004 13:41:55 +0000 (13:41 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 27 Oct 2004 13:41:55 +0000 (13:41 +0000)
* sem_ch3.adb (Complete_Private_Subtype): If the full view is a task
or protected type with discriminants, do not constrain the
corresponding record type if the subtype declaration has no
discriminant constraints. This can be the case in source code, or in
the subtype declaration created to rename an actual type within an
instantiation.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89670 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/sem_ch3.adb

index c48f3b1..fe1cf82 100644 (file)
@@ -7059,9 +7059,15 @@ package body Sem_Ch3 is
          Set_Primitive_Operations (Full, Primitive_Operations (Full_Base));
          Set_Class_Wide_Type      (Full, Class_Wide_Type (Full_Base));
 
+      --  If this is a subtype of a protected or task type, constrain its
+      --  corresponding record, unless this is a subtype without constraints,
+      --  i.e. a simple renaming as with an actual subtype in an instance.
+
       elsif Is_Concurrent_Type (Full_Base) then
          if Has_Discriminants (Full)
            and then Present (Corresponding_Record_Type (Full_Base))
+           and then
+             not Is_Empty_Elmt_List (Discriminant_Constraint (Full))
          then
             Set_Corresponding_Record_Type (Full,
               Constrain_Corresponding_Record