From: robert-j@gmx.de (Robert Jäschke)
Subject: premature usage of incomplete private type
Date: 8 Nov 2001 00:00:00 CET
Date: 2001-11-08T00:00:00+01:00 [thread overview]
Message-ID: <43219ulgvi.cfu.robert-j@oberon.s-s-f.de> (raw)
Hello!
I'm writing a package for Rational-Arithmetics and there I've got a problem.
I want to declare a constant of type Rational before the type itself is
proper defined and I don't know how I can go around this problem:
package My_Math.Rational is
type Rational is private;
Zero : constant Rational := (Z => 0, N => 1);
-- some declarations ...
private
type Rational is record
Z : Integer; -- Z�hler
N : Integer; -- Nenner
end record;
end My_Math.Rational;
If I try to compile this specification, GNAT gives me this error:
gnatgcc -c -gnatg my_math-rational.ads
my_math-rational.ads:10:07: premature usage of incomplete private type
"Rational" defined at line 8
my_math-rational.ads:10:35: expected private type "Rational" defined at line
8
my_math-rational.ads:10:35: found a composite type
gnatmake: "my_math-rational.ads" compilation error
How can I solve this problem without making Rational non-private? Is there
any way, to say the compiler, that this type will be defined later?
Thanks for your help,
Robert
next reply other threads:[~2001-11-07 23:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-07 23:00 Robert Jäschke [this message]
2001-11-08 17:55 ` premature usage of incomplete private type Reivilo Snuved
2001-11-07 23:00 ` Robert Jäschke
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox