comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Incompatible types for array conversion
Date: Wed, 22 Jul 2015 13:32:37 +0100
Date: 2015-07-22T13:32:37+01:00	[thread overview]
Message-ID: <ly1tg0jrtm.fsf@pushface.org> (raw)
In-Reply-To: d18vp0Fg2ulU1@mid.individual.net

Niklas Holsti <niklas.holsti@tidorum.invalid> writes:

> On 15-07-22 10:13 , Simon Wright wrote:
>> Niklas Holsti <niklas.holsti@tidorum.invalid> writes:
>>
>>> The conversion is rejected because of the conversion condition in RM
>>> 4.6 (24.5/2): "The component subtypes shall statically match". The
>>> component (sub)types are Real and Length, which are different types,
>>> although Length is derived from Real. If you change the declaration
>>> of Length to be
>>>
>>>     subtype Length is Real;
>>>
>>> the conversion becomes legal.
>>
>> I tried
>>
>>     generic
>>        dim:		positive;
>>        type Real is digits <>;
>>     package Vectors is
>>        type Vector is array (1..dim) of Real'Base;
>>
>> but it still failed. (GPL 2015, FSF 5.1.0)
>
> Did you expect it to work? Real'Base gets rid of any constraints on
> Real, but AIUI does not get rid of the type derivation; if "type
> Length is new Real", Length'Base is not the same as Real'Base -- the
> "new" makes them different.

Well, who knows what 'statically match' means! (outside the ARG,
anyway). I thought it was worth a try.

  reply	other threads:[~2015-07-22 12:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-22  1:19 Incompatible types for array conversion hreba
2015-07-22  5:20 ` Niklas Holsti
2015-07-22  7:13   ` Simon Wright
2015-07-22  7:41     ` Niklas Holsti
2015-07-22 12:32       ` Simon Wright [this message]
2015-07-27 23:12         ` Randy Brukardt
2015-07-22 13:00   ` hreba
2015-07-22 13:22     ` hreba
2015-07-22 17:50       ` Niklas Holsti
2015-07-22 19:02         ` Dmitry A. Kazakov
2015-07-22  6:49 ` Georg Bauhaus
2015-07-22 12:57   ` hreba
2015-07-22 14:22     ` G.B.
2015-07-23 13:21 ` hreba
replies disabled

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