1-- { dg-do compile }
2-- { dg-options "-gnata" }
3
4procedure Modular5 is
5   type U64 is mod 2 ** 64;
6   Maybe    : Boolean := 2 ** 10 < U64'Succ (U64'last - 1);
7   For_Sure : Boolean := U64'(18446744073709551615) > 2;
8   Ditto    : Boolean := 18446744073709551615 > 2;
9
10   generic
11      type TG is mod <>;
12   package PG is
13     X : TG;
14      pragma Assert (for all K in 1 .. 2 => 2 ** K <= TG'Last);
15      pragma Assert (for all K in 1 .. 2 => 2 ** K <= TG'Last - 1);
16
17     Maybe    : Boolean := 2 ** 10 < TG'Succ (TG'last - 1);
18     For_Sure : Boolean := TG'(18446744073709551615) > 2;
19   end PG;
20
21   package IG is new PG (U64);
22
23begin
24   pragma Assert (for all K in 1 .. 2 => 2 ** K <= U64'Last);
25   pragma Assert (for all K in 1 .. 2 => 2 ** K <= U64'Last - 1);
26end Modular5;
27