[Ada] Spurious error caused by order of interfaces in full view
Commit Message
The frontend reports a spurious error when the order of interfaces
differ between the full view and the partial view of a private type
defined in a generic unit.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_ch3.adb (Reorder_Interfaces): When the conflicting
interface is identified we just replace the interface in the
list of interfaces of the tagged type (instead of adding a
duplicate to the list of interfaces).
@@ -17272,7 +17272,6 @@ package body Sem_Ch3 is
-- append the full view's original parent to the interface list,
-- recursively call Derived_Type_Definition on the full type, and
-- return True. If a match is not found, return False.
- -- ??? This seems broken in the case of generic packages.
------------------------
-- Reorder_Interfaces --
@@ -17281,6 +17280,7 @@ package body Sem_Ch3 is
function Reorder_Interfaces return Boolean is
Iface : Node_Id;
New_Iface : Node_Id;
+
begin
Iface := First (Interface_List (Def));
while Present (Iface) loop
@@ -17290,7 +17290,7 @@ package body Sem_Ch3 is
New_Iface :=
Make_Identifier (Sloc (N), Chars (Parent_Type));
- Append (New_Iface, Interface_List (Def));
+ Rewrite (Iface, New_Iface);
-- Analyze the transformed code