Add new tests
From-SVN: r125529
This commit is contained in:
parent
9c28f283e7
commit
554a540059
11 changed files with 242 additions and 0 deletions
68
gcc/testsuite/gnat.dg/aliased_prefix_accessibility.adb
Normal file
68
gcc/testsuite/gnat.dg/aliased_prefix_accessibility.adb
Normal file
|
@ -0,0 +1,68 @@
|
|||
-- { dg-do run }
|
||||
|
||||
with Tagged_Type_Pkg; use Tagged_Type_Pkg;
|
||||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Aliased_Prefix_Accessibility is
|
||||
|
||||
T_Obj : aliased TT;
|
||||
|
||||
T_Obj_Acc : access TT'Class := T_Obj'Access;
|
||||
|
||||
type Nested_TT is limited record
|
||||
TT_Comp : aliased TT;
|
||||
end record;
|
||||
|
||||
NTT_Obj : Nested_TT;
|
||||
|
||||
ATT_Obj : array (1 .. 2) of aliased TT;
|
||||
|
||||
begin
|
||||
begin
|
||||
T_Obj_Acc := Pass_TT_Access (T_Obj'Access);
|
||||
Put_Line ("FAILED (1): call should have raised an exception");
|
||||
exception
|
||||
when others =>
|
||||
null;
|
||||
end;
|
||||
|
||||
begin
|
||||
T_Obj_Acc := T_Obj.Pass_TT_Access;
|
||||
Put_Line ("FAILED (2): call should have raised an exception");
|
||||
exception
|
||||
when others =>
|
||||
null;
|
||||
end;
|
||||
|
||||
begin
|
||||
T_Obj_Acc := Pass_TT_Access (NTT_Obj.TT_Comp'Access);
|
||||
Put_Line ("FAILED (3): call should have raised an exception");
|
||||
exception
|
||||
when others =>
|
||||
null;
|
||||
end;
|
||||
|
||||
begin
|
||||
T_Obj_Acc := NTT_Obj.TT_Comp.Pass_TT_Access;
|
||||
Put_Line ("FAILED (4): call should have raised an exception");
|
||||
exception
|
||||
when others =>
|
||||
null;
|
||||
end;
|
||||
|
||||
begin
|
||||
T_Obj_Acc := Pass_TT_Access (ATT_Obj (1)'Access);
|
||||
Put_Line ("FAILED (5): call should have raised an exception");
|
||||
exception
|
||||
when others =>
|
||||
null;
|
||||
end;
|
||||
|
||||
begin
|
||||
T_Obj_Acc := ATT_Obj (2).Pass_TT_Access;
|
||||
Put_Line ("FAILED (6): call should have raised an exception");
|
||||
exception
|
||||
when others =>
|
||||
null;
|
||||
end;
|
||||
end Aliased_Prefix_Accessibility;
|
24
gcc/testsuite/gnat.dg/asynch.adb
Normal file
24
gcc/testsuite/gnat.dg/asynch.adb
Normal file
|
@ -0,0 +1,24 @@
|
|||
-- { dg-do compile }
|
||||
|
||||
package body asynch is
|
||||
function null_ctrl return t_ctrl is
|
||||
begin
|
||||
return (Ada.Finalization.Controlled with stuff => 0);
|
||||
end null_ctrl;
|
||||
|
||||
procedure Proc (msg : String; c : t_ctrl := null_ctrl) is
|
||||
begin
|
||||
null;
|
||||
end Proc;
|
||||
|
||||
task type tsk;
|
||||
task body tsk is
|
||||
begin
|
||||
select
|
||||
delay 10.0;
|
||||
Proc ("A message.");
|
||||
then abort
|
||||
null;
|
||||
end select;
|
||||
end tsk;
|
||||
end asynch;
|
8
gcc/testsuite/gnat.dg/asynch.ads
Normal file
8
gcc/testsuite/gnat.dg/asynch.ads
Normal file
|
@ -0,0 +1,8 @@
|
|||
with Ada.Finalization;
|
||||
package asynch is
|
||||
type t_ctrl is new Ada.Finalization.Controlled with record
|
||||
stuff : Natural := 0;
|
||||
end record;
|
||||
|
||||
function null_ctrl return t_ctrl;
|
||||
end asynch;
|
14
gcc/testsuite/gnat.dg/bip_prim_func.adb
Normal file
14
gcc/testsuite/gnat.dg/bip_prim_func.adb
Normal file
|
@ -0,0 +1,14 @@
|
|||
-- { dg-do compile }
|
||||
|
||||
package body BIP_Prim_Func is
|
||||
|
||||
type NTT is new TT with record
|
||||
J : Integer;
|
||||
end record;
|
||||
|
||||
function Prim_Func return NTT is
|
||||
begin
|
||||
return Result : NTT := (I => 1, J => 2);
|
||||
end Prim_Func;
|
||||
|
||||
end BIP_Prim_Func;
|
11
gcc/testsuite/gnat.dg/bip_prim_func.ads
Normal file
11
gcc/testsuite/gnat.dg/bip_prim_func.ads
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
package BIP_Prim_Func is
|
||||
pragma Elaborate_Body;
|
||||
|
||||
type TT is abstract tagged limited record
|
||||
I : Integer;
|
||||
end record;
|
||||
|
||||
function Prim_Func return TT is abstract;
|
||||
|
||||
end BIP_Prim_Func;
|
10
gcc/testsuite/gnat.dg/fixedpnt.adb
Normal file
10
gcc/testsuite/gnat.dg/fixedpnt.adb
Normal file
|
@ -0,0 +1,10 @@
|
|||
-- { dg-do run }
|
||||
|
||||
procedure Fixedpnt is
|
||||
A : Duration := 1.0;
|
||||
B : Duration := Duration ((-1.0) * A);
|
||||
begin
|
||||
if B > 0.0 then
|
||||
raise Constraint_Error;
|
||||
end if;
|
||||
end;
|
31
gcc/testsuite/gnat.dg/interface3.adb
Normal file
31
gcc/testsuite/gnat.dg/interface3.adb
Normal file
|
@ -0,0 +1,31 @@
|
|||
-- { dg-do run }
|
||||
|
||||
procedure interface3 is
|
||||
--
|
||||
package Pkg is
|
||||
type Foo is interface;
|
||||
subtype Element_Type is Foo'Class;
|
||||
--
|
||||
type Element_Access is access Element_Type;
|
||||
type Elements_Type is array (1 .. 1) of Element_Access;
|
||||
type Elements_Access is access Elements_Type;
|
||||
--
|
||||
type Vector is tagged record
|
||||
Elements : Elements_Access;
|
||||
end record;
|
||||
--
|
||||
procedure Test (Obj : Vector);
|
||||
end;
|
||||
--
|
||||
package body Pkg is
|
||||
procedure Test (Obj : Vector) is
|
||||
Elements : Elements_Access := new Elements_Type;
|
||||
--
|
||||
begin
|
||||
Elements (1) := new Element_Type'(Obj.Elements (1).all);
|
||||
end;
|
||||
end;
|
||||
--
|
||||
begin
|
||||
null;
|
||||
end;
|
25
gcc/testsuite/gnat.dg/specs/access3.ads
Normal file
25
gcc/testsuite/gnat.dg/specs/access3.ads
Normal file
|
@ -0,0 +1,25 @@
|
|||
-- { dg-do compile }
|
||||
|
||||
package access3 is
|
||||
type TF is access function return access procedure (P1 : Integer);
|
||||
|
||||
type TAF is access protected function return access procedure (P1 : Integer);
|
||||
|
||||
type TAF2 is access
|
||||
function return access protected procedure (P1 : Integer);
|
||||
|
||||
type TAF3 is access
|
||||
protected function return access protected procedure (P1 : Integer);
|
||||
|
||||
type TAF_Inf is
|
||||
access protected function return
|
||||
access function return
|
||||
access function return
|
||||
access function return
|
||||
access function return
|
||||
access function return
|
||||
access function return
|
||||
access function return
|
||||
access function return
|
||||
Integer;
|
||||
end access3;
|
18
gcc/testsuite/gnat.dg/tagged_type_pkg.adb
Normal file
18
gcc/testsuite/gnat.dg/tagged_type_pkg.adb
Normal file
|
@ -0,0 +1,18 @@
|
|||
package body Tagged_Type_Pkg is
|
||||
|
||||
function Pass_TT_Access (Obj : access TT'Class) return access TT'Class is
|
||||
begin
|
||||
if Obj = null then
|
||||
return null;
|
||||
|
||||
else
|
||||
-- The implicit conversion in the assignment to the return object
|
||||
-- must fail if Obj's actual is not a library-level object.
|
||||
|
||||
return TT_Acc : access TT'Class := Obj do
|
||||
TT_Acc := TT_Acc.Self;
|
||||
end return;
|
||||
end if;
|
||||
end Pass_TT_Access;
|
||||
|
||||
end Tagged_Type_Pkg;
|
9
gcc/testsuite/gnat.dg/tagged_type_pkg.ads
Normal file
9
gcc/testsuite/gnat.dg/tagged_type_pkg.ads
Normal file
|
@ -0,0 +1,9 @@
|
|||
package Tagged_Type_Pkg is
|
||||
|
||||
type TT is tagged limited record
|
||||
Self : access TT'Class := TT'Unchecked_Access;
|
||||
end record;
|
||||
|
||||
function Pass_TT_Access (Obj : access TT'Class) return access TT'Class;
|
||||
|
||||
end Tagged_Type_Pkg;
|
24
gcc/testsuite/gnat.dg/valid1.adb
Normal file
24
gcc/testsuite/gnat.dg/valid1.adb
Normal file
|
@ -0,0 +1,24 @@
|
|||
-- { dg-do run }
|
||||
-- { dg-options "-gnatVi" }
|
||||
|
||||
procedure valid1 is
|
||||
type m is range 0 .. 10;
|
||||
for m'size use 8;
|
||||
|
||||
type r is record
|
||||
a, b : m;
|
||||
c, d, e, f : boolean;
|
||||
end record;
|
||||
pragma Pack (r);
|
||||
for R'size use 20;
|
||||
|
||||
type G is array (1 .. 3, 1 .. 3) of R;
|
||||
pragma Pack (G);
|
||||
|
||||
procedure h (c : m) is begin null; end;
|
||||
|
||||
GG : G := (others => (others => (2, 3, true, true, true, true)));
|
||||
|
||||
begin
|
||||
h (GG (3, 2).a);
|
||||
end;
|
Loading…
Add table
Reference in a new issue