--- gcc/ada/exp_disp.adb +++ gcc/ada/exp_disp.adb @@ -7637,7 +7637,7 @@ package body Exp_Disp is Unchecked_Convert_To (RTE (RE_Prim_Ptr), Make_Attribute_Reference (Loc, Prefix => - New_Occurrence_Of (Alias (Prim), Loc), + New_Occurrence_Of (Ultimate_Alias (Prim), Loc), Attribute_Name => Name_Unrestricted_Access)))); end if; --- /dev/null new file mode 100644 +++ gcc/testsuite/gnat.dg/interface9.adb @@ -0,0 +1,10 @@ +-- { dg-do compile } + +with Interface9_Root.Child; +procedure Interface9 is + package R is new Interface9_Root (Real => Float); + package RC is new R.Child; + +begin + null; +end Interface9; --- /dev/null new file mode 100644 +++ gcc/testsuite/gnat.dg/interface9_root-child.ads @@ -0,0 +1,7 @@ +generic +package Interface9_Root.Child is + type Base_Type is abstract new Base_Interface with null record; + + type Derived_Type is abstract new Base_Type and Derived_Interface + with null record; -- Test +end Interface9_Root.Child; --- /dev/null new file mode 100644 +++ gcc/testsuite/gnat.dg/interface9_root.ads @@ -0,0 +1,10 @@ +generic + type Real is digits <>; +package Interface9_Root is + type Base_Interface is limited interface; + + procedure Primitive1 (B : in out Base_Interface) is abstract; + procedure Primitive2 (B : in out Base_Interface) is null; + + type Derived_Interface is limited interface and Base_Interface; +end Interface9_Root;