summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/specs/discr_record_constant.ads
blob: f43b1386909b5fe16f703f0695036bba421267a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- { dg-do compile }

pragma Restrictions (No_Implicit_Heap_Allocations);

package Discr_Record_Constant 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);

    Var :          T := D;    --  OK, maximum size
    Con : constant T := D;    --  Violation of restriction
    Ter : constant T := Con;  --  Violation of restriction

end Discr_Record_Constant;