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,287f73fa8b0c840d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!newscon06.news.prodigy.com!prodigy.net!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Mon, 25 Apr 2005 18:26:15 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <426d10d1$1_2@newsfeed.slurp.net> <426d20f8$1_1@glkas0286.greenlnk.net> <426d275e$0$1403$ba620e4c@news.skynet.be> Subject: Re: Syntax question: new with a constrained subtype indication Date: Mon, 25 Apr 2005 18:28:34 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4927.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4927.1200 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-jZBidD9bn7pzGtrIM2j9qjDeOC6ETHhx99Mh/ZlGBFmsIjaW3Sl1lt3kJ6yhoErENTn7MTmpmx1kXdF!t9cjSbiSwHFUnuvX0RvVfLgn4brSreQu201aB20gYotYwFYJXDt/V8hEUF9NpqrBG0E9ByBIUzqe X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:10705 Date: 2005-04-25T18:28:34-05:00 List-Id: "Adrien Plisson" wrote in message news:426d275e$0$1403$ba620e4c@news.skynet.be... > Martin Dowie wrote: > > What about 4.8(4): > > > > "An initialized allocator is an allocator with a qualified_expression. An > > uninitialized allocator is one with a subtype_indication. In the > > subtype_indication of an uninitialized allocator, a constraint is > > permitted > > only if the subtype_mark denotes an unconstrained composite subtype; > > if there is no constraint, then the subtype_mark shall denote a definite > > subtype." > > but this one does not forbid to write a scalar_constraint when the > subtype_mark is a composite type... Looking at the RM, I think that the rules for range_constraint cover this (but not very clearly). The bounds of a the range have to have the type of the subtype_mark - 3.5(5). Thus Vector range 1 .. 10; is illegal, because "1" and "10" aren't Vectors. What is not certain to me is why Vector range V1 .. V2; is illegal. (It's nonsense, of course, but ignoring that...) 3.5(4) says that a range specifies some subset of scalar values, but there don't seem to be any rules that back this up (at least, I couldn't find any) - and 3.5(4) is written in the conversational style of introductory text. I would have expected a legality rule ("the bounds of a range shall have a scalar type" or something like that) to reinforce this. I guess I'll have to rely on Dewar's rule (the Standard never says anything that requires nonsense) here. Still, 3.5(4) makes the intent clear, so it doesn't seem worth fixing. As previously noted, the constraint in an allocator is only permitted for composite types, and a range must be scalar, so clearly you can't have a range_constraint in an allocator. Randy.