| 1 |
-- { dg-do compile } |
| 2 |
-- { dg-options "-O2 -gnatws" } |
| 3 |
|
| 4 |
procedure Discr45 is |
| 5 |
|
| 6 |
function Ident_Int (I : Integer) return Integer is |
| 7 |
begin |
| 8 |
return I; |
| 9 |
end; |
| 10 |
|
| 11 |
procedure Proc (Signal : Boolean) is |
| 12 |
|
| 13 |
subtype Index is Integer range 1..10; |
| 14 |
|
| 15 |
type My_Arr is array (Index range <>) OF Integer; |
| 16 |
|
| 17 |
type Rec (D3 : Integer := Ident_Int(1)) is record |
| 18 |
case D3 is |
| 19 |
when -5..10 => C1 : My_Arr(D3..Ident_Int(11)); |
| 20 |
when Others => C2 : Integer := Ident_Int(5); |
| 21 |
end case; |
| 22 |
end record; |
| 23 |
|
| 24 |
X : Rec; |
| 25 |
|
| 26 |
function Value return Rec; |
| 27 |
pragma No_Inline (Value); |
| 28 |
|
| 29 |
function Value return Rec is |
| 30 |
begin |
| 31 |
return X; |
| 32 |
end; |
| 33 |
|
| 34 |
begin |
| 35 |
if X /= Value then |
| 36 |
raise Constraint_Error; |
| 37 |
elsif Signal then |
| 38 |
raise Program_Error; |
| 39 |
end if; |
| 40 |
end; |
| 41 |
|
| 42 |
begin |
| 43 |
Proc (True); |
| 44 |
end; |