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: "David C. Hoos, Sr." Subject: Re: Constraints? Date: 1998/12/22 Message-ID: <75ntvd$bue$1@tsunami.traveller.com>#1/1 X-Deja-AN: 424796646 References: X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Organization: Traveller Information Services Newsgroups: comp.lang.ada Date: 1998-12-22T00:00:00+00:00 List-Id: Simon Wright wrote in message ... >(I think I forgot to post this one, it hasn't appeared here yet; if >duplicated, sorry) > >GNAT thinks the code below is OK, Object Ada (special edition) >doesn't. If OA is right, as I fear it may be, can anyone offer a way >of getting the effect I'm after? > >(t is some abstract base container, i is an abstract iterator over >such a container, n is a concrete container, r is a concrete iterator >over an n) > >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; David C. Hoos, Sr.