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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, PLING_QUERY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c87947d5fda3d7e4 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Operator visibility: why are modular types different??! Date: 1996/05/04 Message-ID: #1/1 X-Deja-AN: 152966117 references: <4mbcuu$4ne@fozzie.sun3.iaf.nl> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-05-04T00:00:00+00:00 List-Id: In article <4mbcuu$4ne@fozzie.sun3.iaf.nl>, Geert Bosch wrote: >procedure UseTest is > > package A is >-- type I is range 0..2**32 - 1; -- Program compiles with this def. > type I is mod 2**32; -- This gives visibility error > end A; > > package B is > subtype J is A.I; > use type J; > end B; > > use B; > > X : J := 1; > >begin > if X /= 1 then This is illegal. The "use type J" makes the operators directly visible inside B. But use clauses are not transitive. The "use B" makes things declared in B directly visible. It does not grab everything directly visible in B. If you moved the "use type J" outside B, then it would work. There is no difference between signed integers and modular integers in this respect. So it sounds like it may be a compiler bug, that the compiler didn't detect the error in the signed case. - Bob