[Bug ada/89178] New: equality for composed types failt when a component has a discriminant and redefines equality

nicolas at debian dot org gcc-bugzilla@gcc.gnu.org
Sun Feb 3 19:05:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89178

            Bug ID: 89178
           Summary: equality for composed types failt when a component has
                    a discriminant and redefines equality
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nicolas at debian dot org
  Target Milestone: ---

'gnatmake p && ./p' outputs twice 'Should be TRUE: FALSE'.

with Ada.Text_IO;
procedure P is
   type T (D : Integer := 0) is record
      case D is
         when others =>
            null;
      end case;
   end record;
   overriding function "=" (A, B : in T) return Boolean is (True);
   T1 : constant T := (D => 1);
   T2 : constant T := (D => 2);
   type R is record
      F : T;
   end record;
   R1 : constant R := (F => T1);
   R2 : constant R := (F => T2);
   type A is array (Positive range 1 .. 1) of T;
   A1 : constant A := (1 => T1);
   A2 : constant A := (1 => T2);
begin
   Ada.Text_IO.Put_Line ("Should be TRUE: " & Boolean'Image (R1 = R2));
   Ada.Text_IO.Put_Line ("Should be TRUE: " & Boolean'Image (A1 = A2));
end P;


More information about the Gcc-bugs mailing list