File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ fun: (inout i:int) -> *int = {
2
+ return i&;
3
+ }
4
+
5
+ fun2: (inout i:int) -> (result : *int) = {
6
+ result = i&;
7
+ }
8
+
9
+ main: (argc : int, argv : **char) -> int = {
10
+ a: int = 2;
11
+ pa: *int = a&;
12
+ ppa: **int = pa&;
13
+
14
+ pa = 0; // caught
15
+
16
+ pa2:= ppa*;
17
+ pa2 = 0; // caught
18
+
19
+ pa3 := a&;
20
+ pa3 = 0; // caught
21
+ pa3 += 2; // caught
22
+
23
+ ppa2 := pa2&;
24
+ pa4 := ppa2*;
25
+ pa4 = 0; // caught
26
+
27
+ pppa := ppa&;
28
+ pa5 := pppa**;
29
+ pa5 = 0; // caught
30
+
31
+ fun(a)++; // caught
32
+ fp := fun(a);
33
+ fp = 0; // caught
34
+
35
+ f := fun(a)*;
36
+
37
+ fp2 := fun2(a).result;
38
+ fp2--; // not caught :(
39
+
40
+ return a * pa* * ppa**; // 8
41
+ }
Original file line number Diff line number Diff line change
1
+ pure2-deducing-pointers.cpp2...
2
+ pure2-deducing-pointers.cpp2(14,8): error: = - pointer assignment from null or integer is illegal
3
+ pure2-deducing-pointers.cpp2(17,9): error: = - pointer assignment from null or integer is illegal
4
+ pure2-deducing-pointers.cpp2(20,9): error: = - pointer assignment from null or integer is illegal
5
+ pure2-deducing-pointers.cpp2(21,9): error: += - pointer assignment from null or integer is illegal
6
+ pure2-deducing-pointers.cpp2(25,9): error: = - pointer assignment from null or integer is illegal
7
+ pure2-deducing-pointers.cpp2(29,9): error: = - pointer assignment from null or integer is illegal
8
+ pure2-deducing-pointers.cpp2(31,11): error: ++ - pointer arithmetic is illegal - use std::span or gsl::span instead
9
+ pure2-deducing-pointers.cpp2(33,8): error: = - pointer assignment from null or integer is illegal
10
+ ==> program violates lifetime safety guarantee - see previous errors
11
+ ==> program violates bounds safety guarantee - see previous errors
12
+
You can’t perform that action at this time.
0 commit comments