file_text
stringlengths
1
2.1M
⌀
language
stringclasses
416 values
file_name
stringlengths
1
185
⌀
-- { dg-do compile } with Discr23_Pkg; use Discr23_Pkg; package body Discr23 is N : constant Text := Get; function Try (A : in Text) return Text is begin return A; exception when others => return N; end; procedure Dummy is begin null; end; end Discr23;
Ada
discr23.adb
package Discr23 is procedure Dummy; end Discr23;
Ada
discr23.ads
package Discr23_Pkg is subtype Size_Range is Positive range 1 .. 256; type Text (Size : Size_Range) is record Characters : String( 1.. Size); end record; function Get return Text; end Discr23_Pkg;
Ada
discr23_pkg.ads
-- { dg-do run } -- { dg-options "-gnatp" } procedure Discr24 is type Family_Type is (Family_Inet, Family_Inet6); type Port_Type is new Natural; subtype Inet_Addr_Comp_Type is Natural range 0 .. 255; type Inet_Addr_VN_Type is array (Natural range <>) of Inet_Addr_Comp_Type; subtype Inet_Addr_V4_Type...
Ada
discr24.adb
-- { dg-do compile } with Discr25_Pkg; procedure Discr25 (N : Natural) is package Test_Set is new Discr25_Pkg (N); begin null; end;
Ada
discr25.adb
package body Discr25_Pkg is type Arr1 is array (Natural range <>) of Integer; B : constant Boolean := N > 0; type Arr2 is array (True .. B) of Integer; type Obj_T (Size_Max : Natural) is record A2 : Arr2; A1 : Arr1 (0 .. Size_Max); end record; procedure Proc1 (Set : in out T) is begin Set...
Ada
discr25_pkg.adb
generic N : Natural; package Discr25_Pkg is type T is private; procedure Proc1 (Set : in out T); private type Obj_T (Size_Max : Natural); type T is access Obj_T; end Discr25_Pkg;
Ada
discr25_pkg.ads
-- { dg-do compile } -- { dg-options "-gnatws" } package body Discr26 is function F1 return My_T1 is R: My_T1; begin return R; end; procedure Proc is begin if F1.D = 0 then raise Program_Error; end if; end; end Discr26;
Ada
discr26.adb
with Discr26_Pkg; package Discr26 is type T1 (D : Integer) is record case D is when 1 => I : Integer; when others => null; end case; end record; type My_T1 is new T1 (Discr26_Pkg.N); procedure Proc; end Discr26;
Ada
discr26.ads
package Discr26_Pkg is function N return Integer; end Discr26_Pkg;
Ada
discr26_pkg.ads
-- { dg-do compile } package body Discr27 is subtype Index is Positive range 1..4096; function F return String is S : String(1..1) := (others =>'w'); begin return S; end; type Enum is (One, Two); type Rec (D : Enum := One; Len : Index := 1) is record case D is when On...
Ada
discr27.adb
package Discr27 is procedure Proc; end Discr27;
Ada
discr27.ads
-- { dg-do compile } package body Discr28 is procedure Dummy (E : Rec) is begin null; end; function F return Rec is begin return Default_Rec; end; procedure Proc1 is begin Dummy (F); end; procedure Proc2 is begin Dummy (F); end; end Discr28;
Ada
discr28.adb
with Discr28_Pkg; package Discr28 is type Enum is (One, Two); type Rec (D : Enum := One) is record case D is when One => null; when Two => S : String (1 .. Discr28_Pkg.N); end case; end record; Default_Rec : constant Rec := (D => One); procedure Proc1; procedure Proc...
Ada
discr28.ads
package Discr28_Pkg is function N return Natural; end Discr28_Pkg;
Ada
discr28_pkg.ads
-- { dg-do compile } package body Discr29 is procedure Proc (R : out Rec3) is begin R := (False, Tmp); end; end Discr29;
Ada
discr29.adb
package Discr29 is type Rec1 is record I1 : Integer; I2 : Integer; I3 : Integer; end record; type Rec2 is tagged record I1 : Integer; I2 : Integer; end record; type Rec3 (D : Boolean) is record case D is when True => A : Rec1; when False => B : Re...
Ada
discr29.ads
-- { dg-do compile } -- { dg-options "-gnatws" } package Discr2 is package Dec is type T_DECIMAL (Prec : Integer := 1) is private; private type T_DECIMAL (Prec : Integer := 1) is record case Prec is when 1 .. 2 => Value : Integer; when others => null; end c...
Ada
discr2_1.ads
package discr3 is type E is range 0..255; type R1 is range 1..5; type R2 is range 11..15; type S1 is array(R1 range <>) of E; type S2 is array(R2 range <>) of E; V1 : S1( 2..3) := (0,0); V2 : S2(12..13) := (1,1); subtype R3 is R1 range 2..3; V3 : S1 (R3); end discr3;
Ada
discr3.ads
-- PR ada/48844 -- Reported by Georg Bauhaus <bauhaus@futureapps.de> */ -- { dg-do compile } procedure Discr30 is generic type Source is private; type Target is private; function Conversion (S : Source) return Target; function Conversion (S : Source) return Target is type Source_Wrapper is ...
Ada
discr30.adb
-- { dg-do compile } -- { dg-options "-O" } package body Discr31 is function Log_Item(Packet : in Packet_Data_Type) return Log_Item_Type is None : Log_Item_Type(0); begin return None; end; end Discr31;
Ada
discr31.adb
package Discr31 is type Byte_List_Type is array(Positive range <>) of Integer; type Log_Item_Type(Last : Natural) is record Data : Byte_List_Type(1 .. Last) := (others => 0); Link : Natural := 0; end record; type Packet_Data_Type is access Log_Item_Type; function Log_Item(Packet : in Pack...
Ada
discr31.ads
-- { dg-do run } -- { dg-options "-gnatws" } with Discr32_Pkg; use Discr32_Pkg; procedure Discr32 is begin if R1'Object_Size /= 32 then raise Program_Error; end if; if R2'Object_Size /= R'Object_Size then raise Program_Error; end if; if R3'Object_Size /= 64 then raise Program_Error; end if;...
Ada
discr32.adb
package Discr32_Pkg is type Enum is (One, Two, Three); type R (D : Enum) is record case D is when One => B : Boolean; when Two => I : Integer; when Three => F : Float; end case; end record; for R use record D at 0 range 0 .. 1; B at 1 range 0 .. 0; I at 4 range 0 ...
Ada
discr32_pkg.ads
-- { dg-do run } procedure Discr33 is subtype Int is Integer range 1..100; type T (D : Int := 1) is record A : Integer; B : String (1..D); C : aliased Integer; end record; Var : T := (D => 1, A => 1234, B => "x", C => 4567); type Int_Ref is access all Integer; ...
Ada
discr33.adb
-- { dg-do compile } with Discr34_Pkg; use Discr34_Pkg; procedure Discr34 is Object : Rec := F; begin null; end;
Ada
discr34.adb
package Discr34_Pkg is function N return Natural; type Enum is (One, Two); type Rec (D : Enum := One) is record case D is when One => S : String (1 .. N); when Two => null; end case; end record; function F return Rec; end Discr34_Pkg;
Ada
discr34_pkg.ads
-- { dg-do compile } package body Discr35 is procedure Proc1 is R : Rec2 := Null_Rec2; begin null; end; procedure Proc2 is R : Rec2; begin R := Null_Rec2; end; end Discr35;
Ada
discr35.adb
package Discr35 is type Rec1 is tagged null record; type Enum is (One, Two); type Rec2 (D : Enum := One) is record case D is when One => null; when Two => R : Rec1; end case; end record; Null_Rec2 : Constant Rec2; procedure Proc1; procedure Proc2; private Null_Rec2 : Co...
Ada
discr35.ads
-- { dg-do compile } with Discr36_Pkg; package body Discr36 is function N return Natural is begin return 0; end; type Arr is array (1 .. N) of R; function My_Func is new Discr36_Pkg.Func (Arr); procedure Proc is A : constant Arr := My_Func; begin null; end; end Discr36;
Ada
discr36.adb
package Discr36 is type R (D : Boolean := True) is record case D is when True => I : Integer; when False => null; end case; end record; function N return Natural; end Discr36;
Ada
discr36.ads
package body Discr36_Pkg is function Func return T is Ret : T; pragma Warnings (Off, Ret); begin return Ret; end; end Discr36_Pkg;
Ada
discr36_pkg.adb
package Discr36_Pkg is generic type T is private; function Func return T; end Discr36_Pkg;
Ada
discr36_pkg.ads
-- { dg-do compile } package body Discr37 is procedure Proc (A : access Child) is B : Derived renames Derived (A.F(1).all); C : Derived renames Derived (B.S(1).all); begin null; end; end Discr37;
Ada
discr37.adb
package Discr37 is subtype Index is Integer range 0 .. 100; type Root; type Frame_Ptr is access all Root'Class; type Arr is array (Index range <>) of Frame_Ptr; type Root (Level : Index) is tagged record S : Arr (0 .. Level); end record; type Derived (Level : Index) is new Root (Level) with null ...
Ada
discr37.ads
-- { dg-do compile } procedure Discr38 is type Enum is (OK, NOT_CONNECTED, DISCONNECTED, REQUEST_Q_EMPTY, SERVER_UNAVAILABLE, BUFFER_TOO_SMALL, NO_FREE_SLOT, RAISE_EXCEPTION, REQU...
Ada
discr38.adb
-- { dg-do run } with System.Storage_Elements; use System.Storage_Elements; procedure Discr39 is type Rec (Has_Src : Boolean) is record case Has_Src is when True => Src : aliased Integer; when False => null; end case; end record; pragma Pack(Rec); for Rec'Alignment use Integer'Alig...
Ada
discr39.adb
-- { dg-do compile } pragma Restrictions (No_Implicit_Heap_Allocations); package Discr3 is type T (Big : Boolean := False) is record case Big is when True => Content : Integer; when False => null; end case; end record; D : constant T := (True, 0); ...
Ada
discr3_1.ads
-- { dg-do run } -- { dg-options "-gnatws" } procedure discr4 is package Pkg is type Rec_Comp (D : access Integer) is record Data : Integer; end record; -- type I is interface; procedure Test (Obj : I) is abstract; -- Num : aliased Integer := 10; -- type Root (D : acce...
Ada
discr4.adb
-- { dg-do compile } -- { dg-options "-O" } with Discr4_Pkg; use Discr4_Pkg; package Discr4 is type Data is record Val : Rec; Set : Boolean; end record; type Pair is record Lower, Upper : Data; end record; function Build (L, U : Rec) return Pair is ((L, True), (U, False)); C1 :...
Ada
discr4.ads
-- { dg-do compile } -- { dg-options "-gnat12 -gnata" } package body Discr40 is procedure Push (S: in out Stack; E : Element) is begin S.Length := S.Length + 1; S.Data(S.Length) := E; end Push; end Discr40;
Ada
discr40.adb
pragma Assertion_Policy(Check); package Discr40 is subtype Element is Integer; type Vector is array (Positive range <>) of Element; type Stack (Max_Length : Natural) is record Length : Natural; Data : Vector (1 .. Max_Length); end record; function Not_Full (S : Stack) return Boolean i...
Ada
discr40.ads
-- { dg-do compile } -- { dg-options "-O" } package body Discr41 is function F return Rec is Ret : Rec (0); begin return Ret; end; end Discr41;
Ada
discr41.adb
package Discr41 is type Vector is array (Positive range <>) of Long_Float; type Date is record LF : Long_Float := 0.0; end record; type Date_Vector is array (Positive range <>) of Date; type Rec (D : Natural) is record B1 : Boolean := False; DL : Date_Vector (1 .. D); VL : Vec...
Ada
discr41.ads
-- { dg-do run } with Discr42_Pkg; use Discr42_Pkg; procedure Discr42 is R : Rec; Pos : Natural := 1; begin R := F (Pos); if Pos /= 2 then raise Program_Error; end if; if R /= (D => True, N => 4) then raise Program_Error; end if; end;
Ada
discr42.adb
package body Discr42_Pkg is function F (Pos : in out Natural) return Rec is begin Pos := Pos + 1; if Pos > 1 then return (D => True, N => Pos * 2); else return (D => False); end if; end; end Discr42_Pkg;
Ada
discr42_pkg.adb
package Discr42_Pkg is type Rec (D : Boolean := False) is record case D is when True => N : Natural; when False => null; end case; end record; function F (Pos : in out Natural) return Rec; end Discr42_Pkg;
Ada
discr42_pkg.ads
-- { dg-do compile } with Text_IO; use Text_IO; procedure Discr43 is type Arr is array (Short_Integer range <>) of Boolean; type Rec (LB : Short_Integer; UB : Short_Integer) is record A : Arr (LB .. UB); end record; begin Put_Line ("Arr'Max_Size =" & Arr'Max_Size_In_Storage_Elements'Img); Put_Line ("...
Ada
discr43.adb
-- { dg-do run } -- { dg-options "-gnatws" } procedure Discr44 is function Ident (I : Integer) return Integer is begin return I; end; type Int is range 1 .. 10; type Str is array (Int range <>) of Character; type Parent (D1, D2 : Int; B : Boolean) is record S : Str (D1 .. D2); end record; ...
Ada
discr44.adb
-- { dg-do compile } -- { dg-options "-O2 -gnatws" } procedure Discr45 is function Ident_Int (I : Integer) return Integer is begin return I; end; procedure Proc (Signal : Boolean) is subtype Index is Integer range 1..10; type My_Arr is array (Index range <>) OF Integer; type Rec (D3 : Inte...
Ada
discr45.adb
-- { dg-do compile } package body Discr46 is function F (Id : Enum) return Integer is Node : Integer := 0; begin if A (Id).R.D = True then Node := A (Id).R.T; end if; return Node; end; end Discr46;
Ada
discr46.adb
package Discr46 is type Enum is (One, Two, Three); for Enum use (One => 1, Two => 2, Three => 3); type Rec1 (D : Boolean := False) is record case D is when False => null; when True => T : Integer; end case; end record; type Rec2 is record R : Rec1; C : Charact...
Ada
discr46.ads
-- { dg-do run } -- { dg-options "-O -gnatws" } procedure Discr47 is type Rec (D : Boolean := False) is record case D is when True => null; when False => C : Character; end case; end record; R : Rec; begin if R'Size /= 16 then raise Program_Error; end if; end;
Ada
discr47.adb
-- { dg-do compile } with Discr48_Pkg; use Discr48_Pkg; function Discr48 return Rec_Access is C : constant Rec := (Count => 1, Seps => (1 .. 0 => Null_XString)); begin return new Rec'(C); end;
Ada
discr48.adb
with Ada.Finalization; package Discr48_Pkg is type XString is new Ada.Finalization.Controlled with record B : Boolean; end record; Null_XString : constant XString := (Ada.Finalization.Controlled with B => False); type XString_Array is array (Natural range <>) of XString; type Rec (Count : Posi...
Ada
discr48_pkg.ads
-- { dg-do run } with Discr49_Rec2; use Discr49_Rec2; procedure Discr49 is Obj : Child (True); I : Integer := Value (Obj) + Boolean'Pos (Obj.Discr); begin if I /= 125 then raise Program_Error; end if; end Discr49;
Ada
discr49.adb
package body Discr49_Rec1 is function Value (Obj : Parent) return Integer is begin return Obj.V + Boolean'Pos (Obj.Discr_1); end; end Discr49_Rec1;
Ada
discr49_rec1.adb
package Discr49_Rec1 is type Parent (Discr_1 : Boolean; Discr_2 : Boolean) is private; function Value (Obj : Parent) return Integer; private type Parent (Discr_1 : Boolean; Discr_2 : Boolean) is record V : Integer := 123; end record; end Discr49_Rec1;
Ada
discr49_rec1.ads
package body Discr49_Rec2 is function Value (Obj : Child) return Integer is begin return Value (Parent (Obj)); end; end Discr49_Rec2;
Ada
discr49_rec2.adb
with Discr49_Rec1; use Discr49_Rec1; package Discr49_Rec2 is type Child (Discr : Boolean) is private; function Value (Obj : Child) return Integer; private type Child (Discr : Boolean) is new Parent (Discr_1 => Discr, Discr_2 => True); end Discr49_Rec2;
Ada
discr49_rec2.ads
package Discr4_Pkg is type Enum is (One, Two, Three); type Rec is private; Rec_One : constant Rec; Rec_Three : constant Rec; function Get (Value : Integer) return Rec; private type Rec (D : Enum := Two) is record case D is when One => null; when Two => Value : Integer; ...
Ada
discr4_pkg.ads
-- { dg-do compile } procedure Discr5 is type Enum is (Ten, Twenty); for Enum use (10, 20); type Arr is array (Enum range <>) of Integer; type Rec (Discr: Enum := Ten) is record case Discr is when others => A: Arr (Ten .. Discr); end case; end record; begin null; en...
Ada
discr5.adb
-- { dg-do compile } with System; package Discr5 is X, Y : Boolean; type R (D : Boolean := False) is tagged limited record F : Integer; case D is when True => F1, F2 : Integer; when False => null; end case; end record; for R use record F1...
Ada
discr5.ads
-- { dg-do compile } procedure Discr50 is type My_Record (D : Integer) is record A : Integer; end record; B : My_Record (Positive range 1 .. 10); -- { dg-error "a subtype indication is not a valid discriminant constraint" } begin null; end Discr50;
Ada
discr50.adb
-- { dg-do compile } with Ada.Containers.Indefinite_Holders; procedure Discr51 is package Inner is type Str (<>) is private; private type Str is array (Positive range <>) of Character; end Inner; package Inner2 is type Str2 (<>) is private; private type str2 is new inner.Str;...
Ada
discr51.adb
-- { dg-do compile } procedure Discr52 is type T_Root (Root_Disc : Natural) is record Data : Natural := 0; end record; type T_Derived (deriv_disc : Natural) is new T_Root (root_disc => deriv_disc); Derived : T_Derived (Deriv_Disc => 3); Value : Natural; procedure Do_Test (Obj : T_Der...
Ada
discr52.adb
-- { dg-do compile } package body Discr53 is function F return Rec is Data : Rec; begin return Data; end; type Ptr is access Rec; procedure Proc is Local : Ptr; begin Local := new Rec'(F); end; end Discr53;
Ada
discr53.adb
with Discr53_Pkg; package Discr53 is type Rec (D : Boolean := False) is record case D is when True => S : String (1 .. Discr53_Pkg.Max); when False => null; end case; end record; function F return Rec; procedure Proc; end Discr53;
Ada
discr53.ads
package Discr53_Pkg is function Max return Natural; end Discr53_Pkg;
Ada
discr53_pkg.ads
-- { dg-do compile } with Discr54_Pkg; pragma Unreferenced (Discr54_Pkg); procedure Discr54 is begin null; end Discr54;
Ada
discr54.adb
package Discr54_Pkg is type E_TYPE is (A_KIND, B_KIND, C_KIND, X_KIND); type DR0 (V : E_TYPE) is tagged record I0 : INTEGER; case V is when A_KIND | B_KIND => I1 : INTEGER; I2 : INTEGER; when C_KIND | X_KIND => I3 : INTEGER; end case; end rec...
Ada
discr54_pkg.ads
-- { dg-do run } procedure Discr55 is type Rec (C : Character) is record case C is when 'Z' .. Character'Val (128) => I : Integer; when others => null; end case; end record; R : Rec ('Z'); begin R.I := 0; end;
Ada
discr55.adb
-- { dg-do compile } package body Discr56 is procedure Dummy is null; end Discr56;
Ada
discr56.adb
with Discr56_Pkg2; package Discr56 is Obj : Discr56_Pkg2.Buffer (1); procedure Dummy; end Discr56;
Ada
discr56.ads
package body Discr56_Pkg1 is protected body Buffer is end Buffer; end Discr56_Pkg1;
Ada
discr56_pkg1.adb
package Discr56_Pkg1 is type Buffer (Size : Positive) is limited private; private type Arr is array (Natural range <>) of Integer; protected type Buffer (Size : Positive) is private Store : Arr (0..Size); end Buffer; end Discr56_Pkg1;
Ada
discr56_pkg1.ads
with Discr56_Pkg1; package Discr56_Pkg2 is type Buffer (Size : Positive) is limited private; private type Buffer (Size : Positive) is new Discr56_Pkg1.Buffer (Size); end Discr56_Pkg2;
Ada
discr56_pkg2.ads
-- { dg-do compile } procedure Discr57 is type T1(Scalar : Boolean) is abstract tagged null record; subtype S1 is T1 (Scalar => False); type T2(Lower_Bound : Natural) is new S1 with null record; Obj : constant T2 := (Lower_Bound => 123); begin null; end Discr57;
Ada
discr57.adb
-- { dg-do compile } with Ada.Text_IO; use Ada.Text_IO; procedure Discr58 is type Field(Flag : Boolean := True) is record case Flag is when True => Param1 : Boolean := False; when False => Param2 : Boolean := True; end case; end record; type Header(Flag : Boolean := True) is...
Ada
discr58.adb
-- { dg-do run } with Discr59_Pkg1; use Discr59_Pkg1; procedure Discr59 is function At_Response_Decode return At_Response_Type is Fill : At_Response_Type (Alert, 1); begin return Fill; end; function Decode return Rec is Make : constant At_Response_Type := At_Response_Decode; Fill...
Ada
discr59.adb
with Discr59_Pkg2; package Discr59_Pkg1 is subtype Index_Type is Natural range 1 .. 300; type Code_Type is (Global_Query, Status_Query, Alert); type Id_Type is (None, At_Command, At_Response); package My_G is new Discr59_Pkg2 (21); type Arr is array (Index_Type range <>) of My_G.Token_Type; typ...
Ada
discr59_pkg1.ads
generic Max_Length : Positive; package Discr59_Pkg2 is type Token_Base_Type (Most : Natural) is record Text : String (1 .. Most) := (others => ' '); Last : Natural := 0; Used : Natural := 0; end record; type Token_Type is new Token_Base_Type (Max_Length); end Dis...
Ada
discr59_pkg2.ads
-- { dg-do compile } package Discr6 is subtype Index_T is Integer range 0 .. 15; type Arr is array (Index_T range <> ) of Long_Long_Integer; type Rec2 (Size : Index_T := 2) is record A : Arr (2 .. Size); end record; type Rec3 (D : Boolean := False) is record R : Rec2; case D is when Fal...
Ada
discr6.ads
-- { dg-do compile } procedure Discr7 is subtype Index is Natural range 0..5; type BitString is array(Index range <>) of Boolean; pragma Pack(BitString); function Id (I : Integer) return Integer is begin return I; end; type E(D : Index) is record C : BitString(1..D); end record; subtype E...
Ada
discr7.adb
-- { dg-do compile } package Discr7 is type Enum is (One, Two, Three); for Enum use (One => 1, Two => 2, Three => 3); type Arr is array (Integer range <>, Enum range <>) of Boolean; type Rec (D : Integer) is record A: Arr (1 .. D, Enum'Range); end record; end Discr7;
Ada
discr7.ads
-- { dg-do compile } -- { dg-options "-gnatws" } package body Discr8 is procedure Make (C : out Local_T) is Tmp : Local_T (Tag_One); begin C := Tmp; end; package Iteration is type Message_T is record S : Local_T; end record; type Iterator_T is record S : Lo...
Ada
discr8.adb
with Discr8_Pkg1; use Discr8_Pkg1; package Discr8 is type Tag_T is (Tag_One, Tag_Two); type Local_T (Tag : Tag_T := Tag_One) is record case Tag is when Tag_One => A : T; B : Integer; when Tag_Two => null; end case; end record; procedure Make (C...
Ada
discr8.ads
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Discr8_Pkg2; use Discr8_Pkg2; package Discr8_Pkg1 is type T is record A : Unbounded_String; B : L; end record; end Discr8_Pkg1;
Ada
discr8_pkg1.ads
with Discr8_Pkg3; use Discr8_Pkg3; package Discr8_Pkg2 is Max : constant Natural := Value; type List_T is array (Natural range <>) of Integer; type L is record List : List_T (1 .. Max); end record; end Discr8_Pkg2;
Ada
discr8_pkg2.ads
package Discr8_Pkg3 is function Value return Natural; end Discr8_Pkg3;
Ada
discr8_pkg3.ads
-- { dg-do compile } package body Discr9 is procedure Proc (From : in R; To : out R) is begin To := R'(D1 => False, D2 => From.D2, Field => From.Field); end; end Discr9;
Ada
discr9.adb
package Discr9 is type IArr is Array (Natural range <>) of Integer; type CArr is Array (Natural range <>) of Character; type Var_R (D1 : Boolean; D2 : Boolean) is record case D1 is when True => L : IArr (1..4); M1, M2 : CArr (1..16); when False => null; end case; end record;...
Ada
discr9.ads
-- { dg-do compile } -- { dg-options "-gnatws" } procedure discr_range_check is Default_First_Entry : constant := 1; task type Server_T (First_Entry : Positive := Default_First_Entry) is entry E (First_Entry .. First_Entry); end Server_T; task body Server_T is begin null; end; type Server_Acces...
Ada
discr_range_check.adb
-- { dg-do compile } procedure Discr_Test is procedure P is begin null; end P; task type Tsk1 is entry rvT; end Tsk1; task body Tsk1 is begin accept rvT; end Tsk1; task type Tsk2 (pS : not null access procedure) is entry rvT; end Tsk2; task body Tsk2 is tskT : Tsk1; begin a...
Ada
discr_test.adb
-- { dg-do compile } procedure Discr_Test2 is type Ptr is access all integer; type Ar is array (Integer range <>) of Ptr; type Inner (Discr : Integer) is record Comp : Ar (1..Discr); end record; type Wrapper (Discr : Integer) is record Comp : Inner (Discr); end record; Val...
Ada
discr_test2.adb
-- { dg-do run } with Disp1_Pkg; use Disp1_Pkg; procedure Disp1 is O : DT_I1; Ptr : access I1'Class; begin Ptr := new I1'Class'(I1'Class (O)); end;
Ada
disp1.adb
package Disp1_Pkg is type I1 is interface; type DT_I1 is new I1 with null record; end Disp1_Pkg;
Ada
disp1_pkg.ads
-- { dg-do run } with Disp2_Pkg; use Disp2_Pkg; procedure Disp2 is Obj : Object_Ptr := new Object; begin if Obj.Get_Ptr /= Obj.Impl_Of then raise Program_Error; end if; end;
Ada
disp2.adb
package body Disp2_Pkg is function Impl_Of (Self : access Object) return Object_Ptr is begin return Object_Ptr (Self); end Impl_Of; end Disp2_Pkg;
Ada
disp2_pkg.adb
package Disp2_Pkg is type Object is tagged null record; type Object_Ptr is access all Object'CLASS; function Impl_Of (Self : access Object) return Object_Ptr; function Get_Ptr (Self : access Object) return Object_Ptr renames Impl_Of; end Disp2_Pkg;
Ada
disp2_pkg.ads