| 1 |
-- { dg-do compile } |
| 2 |
|
| 3 |
procedure Default_Variants is |
| 4 |
|
| 5 |
type Variant_Kind is (A, B); |
| 6 |
|
| 7 |
function Get_Default_Value (Kind : in Variant_Kind) return Natural is (10); |
| 8 |
|
| 9 |
type Variant_Type (Kind : Variant_Kind := A) is |
| 10 |
record |
| 11 |
Common : Natural := Get_Default_Value (Kind); |
| 12 |
case Kind is |
| 13 |
when A => |
| 14 |
A_Value : Integer := Integer'First; |
| 15 |
when B => |
| 16 |
B_Value : Natural := Natural'First; |
| 17 |
end case; |
| 18 |
end record; |
| 19 |
|
| 20 |
type Containing_Type is tagged |
| 21 |
record |
| 22 |
Variant_Data : Variant_Type := |
| 23 |
(Kind => B, Common => <>, B_Value => 1); |
| 24 |
end record; |
| 25 |
|
| 26 |
begin |
| 27 |
null; |
| 28 |
end Default_Variants; |