File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
testsuite/gnat2goto/tests/access-to-object Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,20 @@ procedure Main is
3
3
type Day_Of_Month_Access is access all Day_Of_Month;
4
4
5
5
-- funny case where the subtype-indication has subtype-mark
6
- type C_String_Ptr is access String ( 1 .. Positive'Last) ;
6
+ type Restricted_Day_Of_Month_Access is access all Day_Of_Month range 10 .. 15 ;
7
7
8
8
A : aliased Day_Of_Month;
9
9
Ptr1 : Day_Of_Month_Access := A'Access ;
10
10
Ptr2 : Day_Of_Month_Access := A'Access ;
11
+
12
+ Restricted_A : aliased Day_Of_Month range 10 .. 15 := 12 ;
13
+ Ptr3 : Restricted_Day_Of_Month_Access := Restricted_A'Access ;
11
14
begin
12
15
Ptr1.all := 2 ;
13
16
pragma Assert (A=2 ); -- should succeed
14
17
Ptr2.all := 5 ;
15
18
pragma Assert (Ptr1.all =4 ); -- should fail
19
+
20
+ Ptr3.all := 11 ;
21
+ pragma Assert (Restricted_A = 11 ); -- should succeed
16
22
end ;
Original file line number Diff line number Diff line change 1
- [main.assertion.1] line 13 assertion A=2: SUCCESS
2
- [main.assertion.2] line 15 assertion Ptr1.all=4: FAILURE
1
+ [main.assertion.1] line 16 assertion A=2: SUCCESS
2
+ [main.assertion.2] line 18 assertion Ptr1.all=4: FAILURE
3
+ [main.assertion.3] line 21 assertion Restricted_A = 11: SUCCESS
3
4
VERIFICATION FAILED
You can’t perform that action at this time.
0 commit comments