view gcc/testsuite/gnat.dg/equal3.adb @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 84e7813d76e9
children
line wrap: on
line source

--  { dg-do compile }

procedure Equal3 is
    type R is record
       A, B : Integer;
    end record;

    package Pack is
       type RR is record
          C : R;
       end record;

       X : RR := (C => (A => 1, B => 1));
       Y : RR := (C => (A => 1, B => 2));
       pragma Assert (X /= Y); --@ASSERT:PASS

    end Pack;
    use Pack;
    function "=" (X, Y : R) return Boolean is (X.A = Y.A); --  { dg-error "equality operator must be declared before type \"R\" is frozen \\(RM 4.5.2 \\(9.8\\)\\) \\(Ada 2012\\)" }
begin
    pragma Assert (X /= Y); --@ASSERT:FAIL
end Equal3;