comp.lang.ada
 help / color / mirror / Atom feed
* Private constant of tagged limited controlled type
@ 2011-10-22  6:14 Malaise
  2011-10-22  6:29 ` Jeffrey Carter
  2011-10-23  6:18 ` Malaise
  0 siblings, 2 replies; 4+ messages in thread
From: Malaise @ 2011-10-22  6:14 UTC (permalink / raw)


Hello,
I have difficulties to initialise a private constant of a tagged type
that implements Limited_Controlled.
The following complains that "initialization of limited object
requires aggregate or function call":
with Ada.Finalization;
package Pack is
  type T is tagged limited private;
  C : constant T;
private
  type T is new Ada.Finalization.Limited_Controlled with record
    I : Integer := 0;
  end record;
  V : T;
  C : constant T := V;
end Pack;
Aggregate seems impossible because Limited_Controlled is abstract and
anyway T is very complex in fact.
A function (returning tagged type) has to be visible and anyway cannot
return V (in Ada 2005).

Is there any solution other than access type?
Thank you



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-23  6:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-22  6:14 Private constant of tagged limited controlled type Malaise
2011-10-22  6:29 ` Jeffrey Carter
2011-10-22 15:16   ` Robert A Duff
2011-10-23  6:18 ` Malaise

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