From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,93dce172c8d3e2fb X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Which compiler is correct? Date: 1997/06/18 Message-ID: #1/1 X-Deja-AN: 249440768 References: <33A77C54.5484@bix.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1997-06-18T00:00:00+00:00 List-Id: In article <33A77C54.5484@bix.com>, Tom Moran wrote: >Compilers G and J accept this code. Compiler O gives the error message >indicted in the comment, on said line. Which is correct Ada? Compiler O is correct. The inherited i component of type y is implicitly declared within the private part of a.b. Since a.c cannot see this implicit declaration, the i component of z is never implicitly declared (although it still exists at run time, and you can get at it by doing "x(two).i"). The rules for this stuff are somewhat arcane. See 3.4 and 7.3.1. >package a is > type x is tagged private; >private > type x is tagged record > i:integer; > end record; >end a; >package a.b is > type y is new x with private; >private > type y is new x with record > j:integer; > end record; >end a.b; >with a.b; >package a.c is > type z is new a.b.y with private; > procedure p; >private > type z is new a.b.y with record > k:integer; > end record; >end a.c; >package body a.c is > procedure p is > one:x; > two:z; > begin > one.i:=1; > two.k:=2; > two.i:=3; -- test_vis.ada: Error: line 31 col 13 LRM:4.1.3(5), >No possible interpretation for selected component i, Ignoring future >references > > end p; >end a.c; - Bob