aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/not_null.adb
blob: 7d3c63dc9cdd103a57386f4b1598ba166a50918a (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
--  { dg-do run }

procedure not_null is
   type Not_Null_Int_Ptr is not null access all Integer;
   
   generic
      F : Not_Null_Int_Ptr := null;
   package GPack is
   end GPack;

begin
   declare
      pragma Warnings (Off, "*null not allowed in null-excluding objects");
      pragma Warnings (Off, """Constraint_Error"" will be raised at run time");
      package Inst_2 is new GPack (null);
      pragma Warnings (On, "*null not allowed in null-excluding objects");
      pragma Warnings (On, """Constraint_Error"" will be raised at run time");
   begin
      null;
   end;
exception
   when Constraint_Error =>
      null;
end not_null;