===================================================================
@@ -9300,6 +9300,15 @@
if Ekind (Id) = E_Record_Type_With_Private then
return Full_View (Id);
+ -- If we have a class-wide type that comes from the limited view then
+ -- we return the Underlying_Type of its nonlimited view.
+
+ elsif Ekind (Id) = E_Class_Wide_Type
+ and then From_Limited_With (Id)
+ and then Present (Non_Limited_View (Id))
+ then
+ return Underlying_Type (Non_Limited_View (Id));
+
elsif Ekind (Id) in Incomplete_Or_Private_Kind then
-- If we have an incomplete or private type with a full view,
@@ -9324,9 +9333,8 @@
then
return Underlying_Type (Underlying_Full_View (Id));
- -- If we have an incomplete entity that comes from the limited
- -- view then we return the Underlying_Type of its non-limited
- -- view.
+ -- If we have an incomplete entity that comes from the limited view
+ -- then we return the Underlying_Type of its nonlimited view.
elsif From_Limited_With (Id)
and then Present (Non_Limited_View (Id))
===================================================================
@@ -2235,7 +2235,7 @@
-- issues are taken care of by the virtual machine.
elsif Is_Class_Wide_Type (Ptyp)
- and then Is_Interface (Ptyp)
+ and then Is_Interface (Underlying_Type (Ptyp))
and then Tagged_Type_Expansion
and then not (Nkind (Pref) in N_Has_Entity
and then Is_Subprogram (Entity (Pref)))
@@ -6241,7 +6241,7 @@
elsif Comes_From_Source (N)
and then Is_Class_Wide_Type (Etype (Prefix (N)))
- and then Is_Interface (Etype (Prefix (N)))
+ and then Is_Interface (Underlying_Type (Etype (Prefix (N))))
then
-- Generate:
-- (To_Tag_Ptr (Prefix'Address)).all