aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/rep_clause9.adb
blob: e7a350e76e4b976d460a04138fcde83d3bd37e53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
--  { dg-do run }

procedure Rep_Clause9 is

   type Day_Of_Week
      is (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday);

   type New_Day_Of_Week is new Day_Of_Week  range Monday .. Friday;
   for New_Day_Of_Week use
      (Sunday => -4, Monday => -2, Tuesday => 1, Wednesday => 100,
       Thursday => 1000, Friday => 10000, Saturday => 10001);

   V1 : New_Day_Of_Week;

begin
   if Integer'Image(New_Day_Of_Week'Pos(Monday)) /= " 1" then
      raise Program_Error;
   end if;
   V1 := Monday;
   if Integer'Image(New_Day_Of_Week'Pos(V1)) /= " 1" then
      raise Program_Error;
   end if;
end;