comp.lang.ada
 help / color / mirror / Atom feed
* access type must not be outside generic body
@ 2003-10-06 19:12 chris
  2003-10-07  1:01 ` Matthew Heaney
  0 siblings, 1 reply; 3+ messages in thread
From: chris @ 2003-10-06 19:12 UTC (permalink / raw)


Hi,

What does this mean?  I moved the offending code to the spec and it 
compiles fine.  The situation looks something like this

with aunit.xxx;

generic
   type Test_Raster is new Raster with private;
   Raster_Name : string;

package Test_Rasters is

    type Test_Case is new AUnit.Test_Cases.Test_Case with null record;

    procedure Register_Tests (T : in out Test_Case);
    function  Name           (T : in Test_Case) return String_Access;

end Test_Rasters;


package body Test_Rasters is

    -- touch each pixel to see only valid references exist!
    --
    procedure Valid_Pixels_Test
       (T : in out AUnit.Test_Cases.Test_Case'Class);



    procedure Register_Tests (T : in out Test_Case) is
    begin
       Register_Routine (T,
                         Valid_Pixels_Test'access,
                         "Touch Valid Pixels");
    end Register_Tests;

    function Name (T : in Test_Case) return String_Access is
    begin
       return new String'("Testing " & Raster_Name);
    end Name;

    procedure Valid_Pixels_Test
       (T : in out AUnit.Test_Cases.Test_Case'Class) is
    begin
       null;
    end Valid_Pixels_Test;

end Test_Rasters;


To me the error should be access type must not be in the generic body, 
but it says should not be outside of it.  If the declaration of 
valid_pixels_test is moved to the private section of the spec, it goes 
away (will do what I expect though?).  All the rasters function 
similarly, so ideally only 1 set of tests should be needed.



Cheers,
Chris




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

* Re: access type must not be outside generic body
  2003-10-06 19:12 access type must not be outside generic body chris
@ 2003-10-07  1:01 ` Matthew Heaney
  2003-10-07  8:26   ` chris
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Heaney @ 2003-10-07  1:01 UTC (permalink / raw)


chris <spamoff.danx@ntlworld.com> writes:

> What does this mean?  I moved the offending code to the spec and it
> compiles fine.  The situation looks something like this

This question was asked on 18 Mar 1997, in the thread with the subject
"subprogram access types and generic packages".  For the answer see the
responses from Bob Duff and Tucker Taft.

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=E7CHyw.n0q.0.-s%40inmet.camb.inmet.com&rnum=10&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DISO-8859-1%26q%3Dgeneric%2Bprivate%2Bpart%2Bof%2Bspec%2Baccess%2Btype%2Bbody%26meta%3Dgroup%253Dcomp.lang.ada





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

* Re: access type must not be outside generic body
  2003-10-07  1:01 ` Matthew Heaney
@ 2003-10-07  8:26   ` chris
  0 siblings, 0 replies; 3+ messages in thread
From: chris @ 2003-10-07  8:26 UTC (permalink / raw)


Matthew Heaney wrote:

> This question was asked on 18 Mar 1997, in the thread with the subject
> "subprogram access types and generic packages".  For the answer see the
> responses from Bob Duff and Tucker Taft.

Didn't think of google groups! :(

Thanks!




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

end of thread, other threads:[~2003-10-07  8:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-06 19:12 access type must not be outside generic body chris
2003-10-07  1:01 ` Matthew Heaney
2003-10-07  8:26   ` chris

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