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,bebb281f52290dd4 X-Google-Attributes: gid103376,public From: Simon Wright Subject: Re: Constraints? Date: 1998/12/25 Message-ID: #1/1 X-Deja-AN: 425684341 X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 References: <75ntvd$bue$1@tsunami.traveller.com> X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 914570909 nnrp-08:12025 NO-IDENT pogner.demon.co.uk:158.152.70.98 Organization: At Home Newsgroups: comp.lang.ada Date: 1998-12-25T00:00:00+00:00 List-Id: "David C. Hoos, Sr." writes: > Simon Wright wrote in message ... > >package foo is > > type t is abstract tagged null record; > > type i (f : access t'class) is abstract tagged limited null record; > > type n is new t with null record; > > type r (f : access n) is new i (f) with null record; > > -- OA says foo.ads: Error: line 5 col 37 LRM:3.7(15), Subtype of > > -- discriminant must be statically compatible with subtype of the > > -- corresponding parent discriminant > >end foo; > The real problem is a violation of LRM:3.7(13). > Both compilers will accept the code below. > package foo is > type t is abstract tagged null record; > type i (f : access t'class) is abstract tagged limited null record; > type n is new t with null record; > type a_n is access all n'class; > type r (f : a_n) is new i (f) with null record; > end foo; Thanks for that. I don't quite see what (13) has to do with it? I think I always get frightened by this sort of thing, cos clearly (!!) the code I need (which is also acceptable to both compilers) is package foo is type t is abstract tagged null record; type i (f : access t'class) is abstract tagged limited null record; type n is new t with null record; type r (f : access n'class) is new i (f) with null record; end foo; Referring to my original, Robert Dewar wrote: > This is definitely invalid. GNAT says: > > foo.ads:5:13: subtype must be compatible with parent > discriminant ... so I won't need to report the fact that 3.11B _doesn't_ detect the error, then!