The specification below compiles with CE2019 and GPL2017 but is rejected by CE2020: c_convention_records.ads:5:04: representation item must appear after type is fully defined Is this expected behaviour? CE2020 accepts the specification when pragma Convention is used as for Record_2. Is there an Ada 2012 way to solve this without moving Private_Record out of private part or using a pragma? /Jesper -- package C_Convention_Records is type Private_Record is private; type Record_1 is record -- Line 5 Dummy : Integer; Priv : Private_Record; end record with Convention => C; type Record_2 is record Dummy : Integer; Priv : Private_Record; end record; pragma Convention (C, Record_2); private type Private_Record is record Dummy : Integer; end record with Convention => C; end C_Convention_Records;
On 6/3/20 7:59 PM, Jesper Quorning wrote:
>
> CE2020 accepts the specification when pragma Convention is used as for Record_2.
>
> Is there an Ada 2012 way to solve this without moving Private_Record out of private part or using a pragma?
The aspect and pragma are supposed to be equivalent, so this looks like a
compiler error.
--
Jeff Carter
"Help! Help! I'm being repressed!"
Monty Python & the Holy Grail
67
On Wednesday, June 3, 2020 at 7:59:04 PM UTC+2, Jesper Quorning wrote: > The specification below compiles with CE2019 and GPL2017 but is rejected by > c_convention_records.ads:5:04: representation item must appear after type is fully defined > > Is this expected behaviour? TM 13.1 (9.1/3) : An operational item that directly specifies an aspect of an entity shall appear before the entity is frozen (see 13.14) The pragma should be rejected as well actually. http://www.ada-auth.org/standards/12rm/html/RM-13-1.html
"Fabien Chouteau" <fabien.chouteau@gmail.com> wrote in message
news:f71cc789-9be5-4f7a-9e62-fe2cc97ebbe1o@googlegroups.com...
> On Wednesday, June 3, 2020 at 7:59:04 PM UTC+2, Jesper Quorning wrote:
>> The specification below compiles with CE2019 and GPL2017 but is rejected
>> by > c_convention_records.ads:5:04: representation item must appear after
>> type is fully defined
>>
>> Is this expected behaviour?
>
> TM 13.1 (9.1/3) : An operational item that directly specifies an aspect of
> an entity shall appear before the entity is frozen (see 13.14)
>
> The pragma should be rejected as well actually.
???
I don't see anything in this package specification that freezes any of these
types (other than "end", but of course that's well after the aspects and
pragmas are given). Occurrences in a type declaration don't freeze a type
(if they did, you couldn't mention a private type as a component type at
all, since a partial view cannot be frozen before it is completed).
In any case, the pragma and aspect should be the same, so there's clearly a
bug.
Randy.
On 08/08/2020 04:29, Randy Brukardt wrote:
> I don't see anything in this package specification that freezes any of these
> types (other than "end", but of course that's well after the aspects and
> pragmas are given). Occurrences in a type declaration don't freeze a type
> (if they did, you couldn't mention a private type as a component type at
> all, since a partial view cannot be frozen before it is completed).
>
> In any case, the pragma and aspect should be the same, so there's clearly a
> bug.
A bug in the compiler?
"Luke A. Guest" <laguest@archeia.com> wrote in message
news:rglsd4$147n$1@gioia.aioe.org...
> On 08/08/2020 04:29, Randy Brukardt wrote:
>
>> I don't see anything in this package specification that freezes any of
>> these
>> types (other than "end", but of course that's well after the aspects and
>> pragmas are given). Occurrences in a type declaration don't freeze a type
>> (if they did, you couldn't mention a private type as a component type at
>> all, since a partial view cannot be frozen before it is completed).
>>
>> In any case, the pragma and aspect should be the same, so there's clearly
>> a
>> bug.
>
> A bug in the compiler?
Yes. Regardless of what the correct behavior is for a particular example,
the pragma is equivalent to the aspect so the results should be the same. If
they differ, then there certainly is a compiler bug. *Exactly* what that bug
is might be debatable (although I think it is pretty clear in this case).
Randy.
On 10/08/2020 01:15, Randy Brukardt wrote: >> A bug in the compiler? > > Yes. Regardless of what the correct behavior is for a particular example, > the pragma is equivalent to the aspect so the results should be the same. If > they differ, then there certainly is a compiler bug. *Exactly* what that bug > is might be debatable (although I think it is pretty clear in this case). This is actually a bug filed on my repository https://github.com/Lucretia/sdlada/pull/50/commits/4e80af4ca4f22ee0637af5d6ac277c65c221dcef This is to do with this private part record component: https://github.com/Lucretia/sdlada/blob/master/src/sdl-video-pixel_formats.ads#L655 https://github.com/Lucretia/sdlada/blob/master/src/sdl-video-pixel_formats.ads#L756
"Luke A. Guest" <laguest@archeia.com> writes:
> https://github.com/Lucretia/sdlada/blob/master/src/sdl-video-pixel_formats.ads#L756
Rred_Loss?
On 10/08/2020 10:15, Simon Wright wrote:
> "Luke A. Guest" <laguest@archeia.com> writes:
>
>> https://github.com/Lucretia/sdlada/blob/master/src/sdl-video-pixel_formats.ads#L756
>
> Rred_Loss?
>
Oh, never noticed that.
Guess there is a design problem in the binding..
On 11/08/2020 08:18, Jesper Quorning wrote:
> Guess there is a design problem in the binding..
>
No, it's all pointing at a compiler bug.
tirsdag den 11. august 2020 kl. 09.35.52 UTC+2 skrev Luke A. Guest:
> On 11/08/2020 08:18, Jesper Quorning wrote:
> > Guess there is a design problem in the binding..
> >
> No, it's all pointing at a compiler bug.
Compiler bug and binding design problem I guess..
On 11/08/2020 17:23, Jesper Quorning wrote:
> tirsdag den 11. august 2020 kl. 09.35.52 UTC+2 skrev Luke A. Guest:
>> On 11/08/2020 08:18, Jesper Quorning wrote:
>>> Guess there is a design problem in the binding..
>>>
>> No, it's all pointing at a compiler bug.
>
> Compiler bug and binding design problem I guess..
>
AFAICT from other responses, you're the only person who thinks this. The
binding is fine AFAIK. The only issue might be the that that the padding
record is private.