comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not>
Subject: Re: GNAT or Language Problems?
Date: Sat, 24 Jun 2023 14:23:51 +0200	[thread overview]
Message-ID: <u76n8o$3873$1@dont-email.me> (raw)
In-Reply-To: <u73q5r$3mmom$1@dont-email.me>

On 2023-06-23 11:55, Randy Brukardt wrote:
> 
> Sigh. :Let's start over. My theory was that the problem came from an attempt
> by AdaCore to implement AI22-0041-1, a post Ada-2022 binding interpretation.
> That AI adds a static compatibility requirement to 7.4(6/3) (making it
> 7.4(6/6)). (It of course could just be a bug, too, but AI22-0041-1 seems
> like the only sane reason to be changing the matching code in a working
> compiler that passes the ACATS.)
> 
> There is *no* version of the RM currently that includes the wording from
> post-Ada 2022 AIs (because of we had to wait for ISO to publish the thing
> first). You can only find that in the >50 approved AIs.

Thanks for this clarification. I didn't realize I would have to look at the AI 
itself. I'm using -gnat12, in hopes that the Ada-12 rules would be applied, but 
that doesn't seem to work.

[New version of 7.4(6):]

>    a.. If the deferred constant declaration includes a subtype_indication
> that defines a subtype S1, then the subtype_indication in the full
> declaration shall define a subtype S2 that is statically compatible with S1
> (see 4.9.1). If S1 is a constrained subtype, the constraint defined by S2
> shall statically match the constraint defined by S1. [Redundant: If the
> subtype S1 of the deferred constant is unconstrained, then the full
> declaration is still allowed to impose a constraint.]

As my case doesn't involve the concepts involved in the other PPs, aliased and 
null exclusion, I presume that this PP applies. The essential parts of the code are

    type B_String (Max_Length : Positive := 1_000) is tagged limited private;
    Null_B_String : constant B_String;
    ...
    Null_B_String : constant B_String := (Max_Length => 1, others => <>);

I would think that the subtype indications in the two, being identical, would be 
statically compatible. But my understanding of this may be wrong.

I'm not sure whether the deferred declaration has a constrained subtype, which 
would result in the constraint from the initialization expression of the full 
declaration not matching. But that rule has existed since Ada 95.

I think it would be a mistake for the language to require explicit discriminant 
associations for this case.

So I'm still not able to tell if this is a compiler error or intended by the 
language.

-- 
Jeff Carter
"Insufficient laughter--that's grounds for divorce."
Play It Again, Sam
126

  reply	other threads:[~2023-06-24 12:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 16:36 GNAT or Language Problems? Jeffrey R.Carter
2023-06-17  7:28 ` Randy Brukardt
2023-06-17  9:21   ` Jeffrey R.Carter
2023-06-17 17:50     ` Bill Findlay
2023-06-17 20:49       ` Jeffrey R.Carter
2023-06-22  9:51     ` Randy Brukardt
2023-06-22 12:56       ` Jeffrey R.Carter
2023-06-23  9:55         ` Randy Brukardt
2023-06-24 12:23           ` Jeffrey R.Carter [this message]
2023-06-26 21:42             ` Randy Brukardt
2023-06-27 10:16               ` Jeffrey R.Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox