comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not>
Subject: Re: Aggregate with derived types.
Date: Thu, 14 Sep 2023 17:31:47 +0200	[thread overview]
Message-ID: <udv914$2kqji$1@dont-email.me> (raw)
In-Reply-To: <udv3q0$2l5b9$1@dont-email.me>

On 2023-09-14 16:02, Blady wrote:
> 
>       1. with Ada.Containers.Vectors;
>       2. with Ada.Text_IO;
>       3. procedure test_20230914_derived_agg is
>       4.    package My_Float_Lists is new Ada.Containers.Vectors (Positive, Float);
>       5.    subtype My_Float_List1 is My_Float_Lists.Vector;
>       6.    type My_Float_List2 is new My_Float_Lists.Vector with null record;
>       7.    ML1 : My_Float_List1 := [-3.1, -6.7, 3.3, -3.14, 0.0];
>       8.    ML2 : My_Float_List2 := ([-3.1, -6.7, 3.3, -3.14, 0.0] with null 
> record);
>                                      |
>          >>> error: no unique type for this aggregate

IIUC, you have to qualify the value:

(My_Float_List1'[-3.1, -6.7, 3.3, -3.14, 0.0] with null record)

or

(My_Float_Lists.Vector'[-3.1, -6.7, 3.3, -3.14, 0.0] with null record)

(not tested)

-- 
Jeff Carter
"[M]any were collected near them, ... to
enjoy the sight of a dead young lady, nay,
two dead young ladies, for it proved twice
as fine as the first report."
Persuasion
155

  reply	other threads:[~2023-09-14 15:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-14 14:02 Aggregate with derived types Blady
2023-09-14 15:31 ` Jeffrey R.Carter [this message]
2023-09-14 20:00   ` Blady
2023-09-14 21:37     ` Jeffrey R.Carter
2023-09-15  7:27       ` Blady
2023-09-16  6:39     ` Randy Brukardt
replies disabled

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