gcc/testsuite/gnat.dg/specs/discr3.ads
raw| 1 | -- { dg-do compile } |
| 2 | |
| 3 | pragma Restrictions (No_Implicit_Heap_Allocations); |
| 4 | |
| 5 | package Discr3 is |
| 6 | |
| 7 | type T (Big : Boolean := False) is record |
| 8 | case Big is |
| 9 | when True => |
| 10 | Content : Integer; |
| 11 | when False => |
| 12 | null; |
| 13 | end case; |
| 14 | end record; |
| 15 | |
| 16 | D : constant T := (True, 0); |
| 17 | |
| 18 | Var : T := D; -- OK, maximum size |
| 19 | Con : constant T := D; -- Violation of restriction |
| 20 | Ter : constant T := Con; -- Violation of restriction |
| 21 | |
| 22 | end Discr3; |