summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/tail_call_p.adb
blob: 56add5f6b757938157a90e39b8b01b2f0a1f8e80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package body Tail_Call_P is

  function Start_Side (Element : T) return Index is
  begin
    if Element = 1 then
      raise Program_Error;
    end if;
    if Element = 0 then
      return Second;
    else
      return First;
    end if;
  end;

  function Segment (Element : T) return T is
  begin
    if Element /= 0 then
      raise Program_Error;
    end if;
    return 1;
  end;

  procedure Really_Insert (Into : T; Element : T; Value : T) is
  begin
    if Into /= 0 then
      raise Program_Error;
    end if;
  end;

  procedure Insert (Into : A; Element : T; Value : T) is
  begin
    Really_Insert (Into (Start_Side (Element)), Segment (Element), Value);
  end Insert;

end Tail_Call_P;