comp.lang.ada
 help / color / mirror / Atom feed
* How could I name it ?
@ 1998-11-08  0:00 Fran�oise & Herv� BITTEUR
  1998-11-09  0:00 ` Mats Weber
  1998-11-09  0:00 ` Stephen Leake
  0 siblings, 2 replies; 3+ messages in thread
From: Fran�oise & Herv� BITTEUR @ 1998-11-08  0:00 UTC (permalink / raw)


Please, how could I name the item 'Ptr', belonging to task body 'T' in
the following entry point. I cannot name it simply 'Ptr' since the entry
point already has a 'Ptr' as parameter.

The various constructions, all flagged hereunder with comment "Not OK",
lead to the GNAT compilation message :
	invalid prefix in selected component "T"

How come ? 
Besides, this is a simplified old piece of code (Ada 83) that used to
compile correctly on VaxAda.

Thanks for any clue.
--Herv� BITTEUR

---- cut here -------------------------------------------------------
procedure Test is
   type T;
   type T_Ptr is access T;
   task type T is
      entry Point (Ptr : in T_Ptr);
   end T;
   task body T is
      Ptr : T_Ptr;
      My_Ptr : T_Ptr;
   begin
      accept Point
        (Ptr : in T_Ptr)
      do
         --Ptr := Ptr;                    -- not OK, of course
         My_Ptr := Ptr;                 -- OK, but I don't like it !

         T.Ptr := Ptr;                  -- not OK
         T.My_Ptr := Ptr;               -- not OK

         Test.T.Ptr := Ptr;             -- not OK
         Test.T.My_Ptr := Ptr;          -- not OK
      end Point;
   end T;
begin
   null;
end Test;
--  gnatmake -g test.adb
--  gcc -c -g test.adb
--  test.adb:17:10: invalid prefix in selected component "T"
--  test.adb:18:10: invalid prefix in selected component "T"
--  test.adb:20:14: invalid prefix in selected component "T"
--  test.adb:21:14: invalid prefix in selected component "T"
--  gnatmake: "test.adb" compilation error
----- end of example --------------------------------------------------




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

* Re: How could I name it ?
  1998-11-08  0:00 How could I name it ? Fran�oise & Herv� BITTEUR
@ 1998-11-09  0:00 ` Mats Weber
  1998-11-09  0:00 ` Stephen Leake
  1 sibling, 0 replies; 3+ messages in thread
From: Mats Weber @ 1998-11-09  0:00 UTC (permalink / raw)


"Fran�oise & Herv� BITTEUR" wrote:

> procedure Test is
>    type T;
>    type T_Ptr is access T;
>    task type T is
>       entry Point (Ptr : in T_Ptr);
>    end T;
>    task body T is
>       Ptr : T_Ptr;
>       My_Ptr : T_Ptr;
>    begin
>       accept Point
>         (Ptr : in T_Ptr)
>       do
>          --Ptr := Ptr;                    -- not OK, of course
>          My_Ptr := Ptr;                 -- OK, but I don't like it !
> 
>          T.Ptr := Ptr;                  -- not OK

This is OK. GNAT had a bug that rejected it, I am not sure if it is
fixed in 3.10p.

>          T.My_Ptr := Ptr;               -- not OK

This is legal as well.

>          Test.T.Ptr := Ptr;             -- not OK
>          Test.T.My_Ptr := Ptr;          -- not OK

The above two are also legal.

>       end Point;
>    end T;
> begin
>    null;
> end Test;e




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

* Re: How could I name it ?
  1998-11-08  0:00 How could I name it ? Fran�oise & Herv� BITTEUR
  1998-11-09  0:00 ` Mats Weber
@ 1998-11-09  0:00 ` Stephen Leake
  1 sibling, 0 replies; 3+ messages in thread
From: Stephen Leake @ 1998-11-09  0:00 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1886 bytes --]

Fran�oise & Herv� BITTEUR <hbitteur@club-internet.fr> writes:

> Please, how could I name the item 'Ptr', belonging to task body 'T' in
> the following entry point. I cannot name it simply 'Ptr' since the entry
> point already has a 'Ptr' as parameter.
> 
> The various constructions, all flagged hereunder with comment "Not OK",
> lead to the GNAT compilation message :
> 	invalid prefix in selected component "T"
> 
> How come ? 
> Besides, this is a simplified old piece of code (Ada 83) that used to
> compile correctly on VaxAda.
> 

Compiling with ObjectAda 7.1.2 gives no errors for the code below. So
you've got a GNAT bug (which I also reproduced).

> Thanks for any clue.
> --Herv� BITTEUR
> 
> ---- cut here -------------------------------------------------------
> procedure Test is
>    type T;
>    type T_Ptr is access T;
>    task type T is
>       entry Point (Ptr : in T_Ptr);
>    end T;
>    task body T is
>       Ptr : T_Ptr;
>       My_Ptr : T_Ptr;
>    begin
>       accept Point
>         (Ptr : in T_Ptr)
>       do
>          --Ptr := Ptr;                    -- not OK, of course
>          My_Ptr := Ptr;                 -- OK, but I don't like it !
> 
>          T.Ptr := Ptr;                  -- not OK
>          T.My_Ptr := Ptr;               -- not OK
> 
>          Test.T.Ptr := Ptr;             -- not OK
>          Test.T.My_Ptr := Ptr;          -- not OK
>       end Point;
>    end T;
> begin
>    null;
> end Test;
> --  gnatmake -g test.adb
> --  gcc -c -g test.adb
> --  test.adb:17:10: invalid prefix in selected component "T"
> --  test.adb:18:10: invalid prefix in selected component "T"
> --  test.adb:20:14: invalid prefix in selected component "T"
> --  test.adb:21:14: invalid prefix in selected component "T"
> --  gnatmake: "test.adb" compilation error
> ----- end of example --------------------------------------------------




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

end of thread, other threads:[~1998-11-09  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-11-08  0:00 How could I name it ? Fran�oise & Herv� BITTEUR
1998-11-09  0:00 ` Mats Weber
1998-11-09  0:00 ` Stephen Leake

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