comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: prefix of dereference must be a name?
Date: Thu, 30 Jul 2009 03:09:31 -0400
Date: 2009-07-30T03:09:31-04:00	[thread overview]
Message-ID: <u4osuzlxw.fsf@stephe-leake.org> (raw)

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.

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?

-- 
-- Stephe



             reply	other threads:[~2009-07-30  7:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-30  7:09 Stephen Leake [this message]
2009-07-30 17:36 ` prefix of dereference must be a name? 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
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