comp.lang.ada
 help / color / mirror / Atom feed
* prefix of dereference must be a name?
@ 2009-07-30  7:09 Stephen Leake
  2009-07-30 17:36 ` Yannick Duchêne Hibou57
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Stephen Leake @ 2009-07-30  7:09 UTC (permalink / 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



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

end of thread, other threads:[~2009-08-04  3:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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