xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.ada/sub_variant/subv.adb (revision ae87de8892f277bece3527c15b186ebcfa188227)
1--  Copyright 2020 Free Software Foundation, Inc.
2--
3--  This program is free software; you can redistribute it and/or modify
4--  it under the terms of the GNU General Public License as published by
5--  the Free Software Foundation; either version 3 of the License, or
6--  (at your option) any later version.
7--
8--  This program is distributed in the hope that it will be useful,
9--  but WITHOUT ANY WARRANTY; without even the implied warranty of
10--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11--  GNU General Public License for more details.
12--
13--  You should have received a copy of the GNU General Public License
14--  along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16procedure Subv is
17  type Indicator_T is (First, Last);
18
19  type T1 (Indicator : Indicator_T := First) is
20    record
21      case Indicator is
22        when First =>
23          Value : Natural;
24        when Last =>
25          null;
26      end case;
27    end record;
28
29  type T2 (Indicator : Indicator_T := First) is
30    record
31      Associated : T1;
32      case Indicator is
33        when First =>
34          Value : Natural;
35        when Last =>
36          null;
37      end case;
38    end record;
39
40  Q : T2  := ( First, (First, 42), 51 );
41  R : T2  := ( First, (Indicator => Last), 51 );
42  S : T2  := ( Last, (First, 42));
43begin
44  null;  -- STOP
45end;
46