comp.lang.ada
 help / color / mirror / Atom feed
From: chris <spamoff.danx@ntlworld.com>
Subject: access type must not be outside generic body
Date: Mon, 06 Oct 2003 20:12:46 +0100
Date: 2003-10-06T20:12:46+01:00	[thread overview]
Message-ID: <G3jgb.8193$QH3.3482@newsfep4-winn.server.ntli.net> (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




             reply	other threads:[~2003-10-06 19:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-06 19:12 chris [this message]
2003-10-07  1:01 ` access type must not be outside generic body Matthew Heaney
2003-10-07  8:26   ` chris
replies disabled

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