OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gnat.dg/] [old_errors.adb] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 304 jeremybenn
-- { dg-do compile }
2
package body Old_Errors is
3
 
4
   A : Integer;
5
 
6
   function F
7
     (X : Integer := A'Old) -- { dg-error "can only appear within subprogram" }
8
     return Integer is
9
   begin
10
      return X;
11
   end F;
12
 
13
   procedure P (I : in Integer; O : out Integer; IO : in out Integer) is
14
      Y : Integer := 0;
15
      function G
16
        (X : Integer := Y'Old) -- { dg-error "cannot refer to local variable" }
17
        return Integer is
18
      begin
19
         return X;
20
      end G;
21
 
22
      function H (X : Integer := A'Old) return Integer is  -- OK
23
      begin
24
         return X;
25
      end H;
26
 
27
   begin
28
      Y := Y'Old; -- { dg-error "cannot refer to local variable" }
29
      declare
30
         Z : Integer := 0;
31
         procedure Inner is
32
            IL : Integer := 0;
33
         begin
34
            IL := IL'Old; -- { dg-error "cannot refer to local variable" }
35
            Z  := Z'Old;  -- OK
36
         end Inner;
37
      begin
38
         Y := Z'Old; -- { dg-error "cannot refer to local variable" }
39
      end;
40
      Y := I'Old;   -- { dg-warning "Old applied to constant has no effect" }
41
      Y := O'Old;   -- OK
42
      Y := IO'Old;  -- OK
43
      Y := G;       -- OK, error has been signalled at G declaration
44
      pragma Assert (G (3)'Old = Y); -- { dg-error "cannot refer to local variable" }
45
   end P;
46
 
47
end Old_Errors;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.