summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/protected_self_ref1.adb
blob: b6c2aef6809bcf65fc22a9f48c3cb94f9d4e29de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--  { dg-do run }
with System;

procedure Protected_Self_Ref1 is

   protected type P is
      procedure Foo;
   end P;

   protected body P is
      procedure Foo is
         Ptr : access P;  -- here P denotes the type P
	 T   : Integer;
	 A   : System.Address;
      begin
         Ptr := P'Access; -- here P denotes the "this" instance of P
	 T := P'Size;
	 A := P'Address;
      end;
   end P;

   O : P;
begin
   O.Foo;
end Protected_Self_Ref1;