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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c022fc5445abd13d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!news.abs.net!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Discriminated types with default discriminants References: From: Stephen Leake Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:+pqOLRIi+1nkhbanULLf81r0a0A= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 04 Nov 2005 08:09:36 -0500 NNTP-Posting-Host: 66.159.65.1 X-Complaints-To: abuse@toad.net X-Trace: news.abs.net 1131109788 66.159.65.1 (Fri, 04 Nov 2005 08:09:48 EST) NNTP-Posting-Date: Fri, 04 Nov 2005 08:09:48 EST Xref: g2news1.google.com comp.lang.ada:6185 Date: 2005-11-04T08:09:36-05:00 List-Id: Brian May writes: >>>>>> "Maciej" == Maciej Sobczak writes: > I am > still confused with the first warning: > > > Maciej> 5. Value : String (1..Size); > Maciej> | > >>>> warning: creation of object of this type may raise > Maciej> Storage_Error > > Why does this warning go away when using an unbounded subtype? Doesn't > the issue still exist? > > Maciej> I can get rid of the first warning with this: > > Maciej> subtype MyInt is Integer; > Maciej> type Discriminated(Size : MyInt := 10) is > Maciej> -- ... This is just a compiler bug. It assumes that since you specified a subtype, things are ok, and suppresses the warning. Note that 'warnings' are not defined by the language; they are provided by the compiler implementor in an attempt to make the compiler easier to use. You could report this to AdaCore (send an email to report@gnat.com); they typically take warning and error message issues seriously, since that is a good marketing point. -- -- Stephe