From: "John B. Matthews" <nospam@nospam.invalid>
Subject: Re: prefix of dereference must be a name?
Date: Thu, 30 Jul 2009 15:35:02 -0400
Date: 2009-07-30T15:35:02-04:00 [thread overview]
Message-ID: <nospam-96AE3E.15350230072009@news.aioe.org> (raw)
In-Reply-To: u4osuzlxw.fsf@stephe-leake.org
In article <u4osuzlxw.fsf@stephe-leake.org>,
Stephen Leake <stephen_leake@stephe-leake.org> wrote:
> I'd like to be able to do the following:
>
> type T is record ... end record;
> type T_Access is access all T;
>
> function "+" (Left, Right in : ...) return T_Access;
>
> A : T_Access := new T;
> B : T_Access := new T;
> C : T_Access := A + B;
>
> A.all := (C + B).all;
>
> but GNAT complains that "prefix for selection is not a name", pointing
> to (C + B).all.
>
> So then I tried:
>
> function "-" (Token : in T_Access) return T_Access
> is begin
> return Token;
> end;
>
> A.all := -(C + B).all;
>
> and got the same error. Finally I tried:
>
> function Copy (Token : in T_Access) return T_Access
> is begin
> return Token;
> end;
>
> A.all := Copy (C + B).all;
>
> And the compiler was happy.
Interesting. The compiler was happy with a function call:
A.all := "+"(C, B).all;
but a use_type_clause didn't seem to help.
> What's the rationale for this?
>
> I assume one issue here is that "-" might be an intrinsic, but since
> the type involved is not a numeric type, I don't see how that could be
> a problem.
>
> Similarly for ().all; when could that be a problem?
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
next prev parent reply other threads:[~2009-07-30 19:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-30 7:09 prefix of dereference must be a name? Stephen Leake
2009-07-30 17:36 ` Yannick Duchêne Hibou57
2009-07-31 12:04 ` Stephen Leake
2009-07-31 12:23 ` Dmitry A. Kazakov
2009-07-31 21:49 ` Robert A Duff
2009-07-30 19:35 ` John B. Matthews [this message]
2009-08-03 14:44 ` Adam Beneschan
2009-08-03 17:46 ` John B. Matthews
2009-08-04 1:45 ` Adam Beneschan
2009-08-04 3:37 ` Yannick Duchêne Hibou57
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox