view gcc/testsuite/gnat.dg/modular5.adb @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

-- { dg-do compile }
-- { dg-options "-gnata" }

procedure Modular5 is
   type U64 is mod 2 ** 64;
   Maybe    : Boolean := 2 ** 10 < U64'Succ (U64'last - 1);
   For_Sure : Boolean := U64'(18446744073709551615) > 2;
   Ditto    : Boolean := 18446744073709551615 > 2;

   generic
      type TG is mod <>;
   package PG is
     X : TG;
      pragma Assert (for all K in 1 .. 2 => 2 ** K <= TG'Last);
      pragma Assert (for all K in 1 .. 2 => 2 ** K <= TG'Last - 1);

     Maybe    : Boolean := 2 ** 10 < TG'Succ (TG'last - 1);
     For_Sure : Boolean := TG'(18446744073709551615) > 2;
   end PG;

   package IG is new PG (U64);

begin
   pragma Assert (for all K in 1 .. 2 => 2 ** K <= U64'Last);
   pragma Assert (for all K in 1 .. 2 => 2 ** K <= U64'Last - 1);
end Modular5;