1-- LA140062.AM
2--
3--                             Grant of Unlimited Rights
4--
5--     Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6--     F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7--     unlimited rights in the software and documentation contained herein.
8--     Unlimited rights are defined in DFAR 252.227-7013(a)(19).  By making
9--     this public release, the Government intends to confer upon all
10--     recipients unlimited rights  equal to those held by the Government.
11--     These rights include rights to use, duplicate, release or disclose the
12--     released technical data and computer software in whole or in part, in
13--     any manner and for any purpose whatsoever, and to have or permit others
14--     to do so.
15--
16--                                    DISCLAIMER
17--
18--     ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19--     DISCLOSED ARE AS IS.  THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20--     WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21--     SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22--     OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23--     PARTICULAR PURPOSE OF SAID MATERIAL.
24--*
25--
26-- OBJECTIVE:
27--      Check that a compilation unit may not depend semantically
28--      on two different versions of the same compilation unit.
29--      Check the case where a generic package depends on another
30--      generic package specification.
31--
32-- TEST DESCRIPTION:
33--      This test compiles a generic package specification, then
34--      compiles a generic package specification and body,
35--      followed by a procedure that makes a call to a procedure
36--      contained inside the second generic package.  Then, the
37--      first generic package specification is recompiled,
38--      making the body of the generic package LA140060 obsolete.
39--      Unless automatic recompilation is supported this test should
40--      fail to link.  Otherwise, the test should recompile and link
41--      the correct version of the units and report "PASSED" at
42--      execution time.
43--
44-- SPECIAL REQUIREMENTS:
45--      To build this test:
46--         1) Compile the file LA140060 (and include the results in the
47--            program library).
48--         2) Compile the file LA140061 (and include the results in the
49--            program library).
50--         3) Compile the file LA140062 (and include the results in the
51--            program library).
52--         4) Compile the file LA140063 (and include the results in the
53--            program library).
54--         5) Attempt to build an executable image.
55--         6) If an executable image results, run it.
56--
57-- TEST FILES:
58--      This test consists of the following files:
59--         LA140060.A
60--         LA140061.A
61--      -> LA140062.AM
62--         LA140063.A
63--
64-- PASS/FAIL CRITERIA:
65--      Expect a link-time error message that the body of generic
66--      package LA14006_1 is missing or obsolete.  If automatic
67--      recompilation is supported, and an executable image is
68--      built, expect a "PASSED" message from execution.
69--
70--
71-- CHANGE HISTORY:
72--     01 MAY 95   ACVC 1.12   LA5008K baseline version
73--     09 MAY 95   SAIC        Initial version
74--     17 NOV 96   SAIC        Modified unit names and prologue to conform
75--                             to coding conventions.
76--     07 DEC 96   SAIC        Moved LA14006_0 to a separate file. Added
77--                             pragma Elaborate to context clause of LA14006_2.
78--
79--!
80
81with LA14006_0;
82with LA14006_types;
83use  LA14006_types;
84generic
85     type additional is (<>);
86     add_val : additional;
87package LA14006_1 is
88     type T3 is new t_type with record
89          h: additional := add_val;
90     end record;
91
92     procedure P (TC_Change : out integer);
93
94     package inst is new LA14006_0 (T3);
95end LA14006_1;
96
97----------------------------------------------------------------
98
99package body LA14006_1 is
100     procedure P (TC_Change : out integer) is
101     begin
102           TC_Change := inst.TC_Var.g;
103     end P;
104end LA14006_1;
105
106----------------------------------------------------------------
107
108with LA14006_1;
109pragma Elaborate (LA14006_1);
110package LA14006_2 is new LA14006_1 (integer, 300);
111
112----------------------------------------------------------------
113
114with Report; use Report;
115with LA14006_2;
116procedure LA140062 is
117     TC_Val : integer := 0;
118begin
119     Test ("LA14006", "Check that a compilation unit may not " &
120                      "depend semantically on two different " &
121                      "versions of the same compilation unit. " &
122                      "Check the case where a generic package " &
123                      "depends on another generic package " &
124                      "specification");
125
126     LA14006_2.P (TC_Val);
127
128     if TC_Val = 100 then
129          Failed ("Obsolete unit used in elaboration");
130     elsif TC_Val /= -10 then
131          Failed ("Incorrect test value received");
132     end if;
133
134     Result;
135end LA140062;
136