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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.198.12 with SMTP id w12mr4454836iof.105.1521128266547; Thu, 15 Mar 2018 08:37:46 -0700 (PDT) X-Received: by 10.157.14.214 with SMTP id 80mr462802otj.9.1521128266372; Thu, 15 Mar 2018 08:37:46 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.unit0.net!peer02.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!e10-v6no12060itf.0!news-out.google.com!h73-v6ni1itb.0!nntp.google.com!e10-v6no12057itf.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 15 Mar 2018 08:37:46 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=20.133.40.13; posting-account=YRfoYAoAAADhSEO2nLYx10QUUvp8akYl NNTP-Posting-Host: 20.133.40.13 References: <365d65ea-5f4b-4b6a-be9b-1bba146394ab@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Ada case-statement From: Stephen Davies Injection-Date: Thu, 15 Mar 2018 15:37:46 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Body-CRC: 4054064724 X-Received-Bytes: 2128 Xref: reader02.eternal-september.org comp.lang.ada:50996 Date: 2018-03-15T08:37:46-07:00 List-Id: On Wednesday, 14 March 2018 23:16:29 UTC, Randy Brukardt wrote: > declare > Selector : Day_Type renames Calculate_Day; > subtype Weekend_Subtype is Day_Type range Sat .. Sun; > -- Or use a static predicate if the range is discontiguous. > begin > case Selector is > when Mon .. Fri => > ... > when Sat | Sun => > ... > case Weekend_Subtype'(Selector) is -- A type conversion works, too. > when Sat => > ... > when Sun => > ... > end case; > end case; > end; Unless this has changed in more recent compilers, the static predicate when Sat & Sun are not contiguous does not work. Gnatpro 7.0.2 complains about missing values. Also, attempting to use "when Weekend_Subtype" in the outer case-statement results in complaints about duplicate values.