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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: GNAT GPL 2013 bug? Date: Fri, 9 Aug 2013 11:47:07 +0200 Organization: cbb software GmbH Message-ID: <19fr4wmxmen$.gjbias2fj461$.dlg@40tude.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: akU61YSCmz18VAS8AmGZtg.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: news.eternal-september.org comp.lang.ada:16712 Date: 2013-08-09T11:47:07+02:00 List-Id: ARM 3.9.2(10/2) "... If the dispatching operation overrides an inherited subprogram, it shall be subtype conformant with the inherited subprogram." Does not-null constraint count? To me (I am not a language layer) it does. But GNAT GPL 2013 (20130314) swallows this: type T is tagged null record; procedure P (X : access T) is null; type S is new T with null record; overriding procedure P (X : not null access S) is null; Which is a bug to me. P.S. Being subtype conformant to another type (T vs S) is a tricky part. Presumably "the inherited subprogram" is procedure P (X : access T); after T is replaced by S. Which gives procedure P (X : access S); and this must be subtype conformant to overriding procedure P (X : not null access S); which is not. Is it? P.P.S. There is of course a deeper issue with any constraints put on or lifted upon inheritance regarding LSP and substitutability. Because it might be safe to weaken a constraint (precondition actually). E.g. turning the example around: type T is tagged null record; procedure P (X : not null access T); type S is new T with null record; overriding procedure P (X : access S); This might be safe as the clients are promised more. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de