procedure test1 is

   type T1 is tagged null record;

   procedure p1 (x: T1) is
   begin
      null;
   end p1;

   procedure p2 (x: T1'class) is
   begin
      null;
   end p2;

   procedure p3 (x: access T1) is
   begin
      null;
   end p3;

   procedure p4 (x: access T1'class) is
   begin
      null;
   end p4;

   package pak is
      type T2 is tagged null record;
      procedure p5 (x: T2);
      procedure p6 (x: T2'class);
      procedure p7 (x: access T2);
      procedure p8 (x: access T2'class);
   end pak;

   package body pak is
      procedure p5 (x: T2) is
      begin
         null;
      end p5;

      procedure p6 (x: T2'class) is
      begin
         null;
      end p6;

      procedure p7 (x: access T2) is
      begin
         null;
      end p7;

      procedure p8 (x: access T2'class) is
      begin
         null;
      end p8;

   end pak;

   y1: T1 := (null record);
   y2: access T1;
   y3: pak.T2 := (null record);
   y4: access pak.T2;

begin
   y1.p1; -- line 62
   y1.p2;
   y2.p3; -- line 64
   y2.p4; -- line 65
   y3.p5;
   y3.p6;
   y4.p7;
   y4.p8; -- line 69
end test1;

gnatmake -gnat05 test1
gcc-4.1 -c -gnat05 test1.adb
test1.adb:62:06: no selector "p1" for type "T1" defined at line 3
test1.adb:64:06: no selector "p3" for type "T1" defined at line 3
test1.adb:65:06: no selector "p4" for type "T1" defined at line 3
test1.adb:69:06: no selector "p8" for type "T2" defined at line 26

Also fails with the same error messages in GCC 4.2.2.  Funny that the compiler
doesn't see p1 or p3 but does see p5 and p7 simply because they are in a nested
package.


-- 
           Summary: Legal program rejected, Ada 2005 prefix notation, RM
                    4.1.3(9.2/2), 6.4(10.1/2)
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic at ludovic-brenta dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34343

Reply via email to