--  A class-wide object initialised from a view conversion is a copy of the object whole,
--  its extension included (RM 4.6(5/2)); a specific tagged type's equality compares its
--  components, not the tags of the objects viewed (RM 4.5.2(14/3))
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
   package P is
      type Root is tagged record
         N : Integer := 0;
      end record;
      type Child is new Root with record
         S : String (1 .. 5) := "-----";
      end record;
      function Make return Root'Class;
   end P;
   package body P is
      function Make return Root'Class is
         A : constant Child := (N => 15, S => "Hello");
         X : constant Root'Class := Root (A);
      begin
         return X;
      end Make;
   end P;
   use P;
   V : constant Child := (N => 15, S => "Hello");
   M : constant Root'Class := Make;
begin
   Put_Line (Boolean'Image (Root'Class (V) = M));
   Put_Line (Boolean'Image (Root (V) = Root'(N => 15)));
   pragma Assert (Root (V) = Root'(N => 15));
end Main;
