===================================================================
@@ -4064,6 +4064,19 @@
T := Process_Subtype (Subtype_Indication (N), N, Id, 'P');
+ -- Class-wide equivalent types of records with unknown discriminants
+ -- involve the generation of an itype which serves as the private view
+ -- of a constrained record subtype. In such cases the base type of the
+ -- current subtype we are processing is the private itype. Use the full
+ -- of the private itype when decorating various attributes.
+
+ if Is_Itype (T)
+ and then Is_Private_Type (T)
+ and then Present (Full_View (T))
+ then
+ T := Full_View (T);
+ end if;
+
-- Inherit common attributes
Set_Is_Generic_Type (Id, Is_Generic_Type (Base_Type (T)));
===================================================================
@@ -1123,6 +1123,10 @@
D_Type : Entity_Id;
begin
+ -- Perform minor decoration as it is needed by the side effect
+ -- removal mechanism.
+
+ Set_Etype (Deref, Desig_T);
Set_Parent (Deref, Free_Node);
D_Subtyp := Make_Subtype_From_Expr (Deref, Desig_T);