File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ comptime {
20
20
_ = @import ("behavior/bugs/1486.zig" );
21
21
_ = @import ("behavior/bugs/1500.zig" );
22
22
_ = @import ("behavior/bugs/1851.zig" );
23
+ _ = @import ("behavior/bugs/1914.zig" );
23
24
_ = @import ("behavior/bugs/2006.zig" );
24
25
_ = @import ("behavior/bugs/394.zig" );
25
26
_ = @import ("behavior/bugs/421.zig" );
Original file line number Diff line number Diff line change
1
+ const std = @import ("std" );
2
+
3
+ const A = struct {
4
+ b_list_pointer : * const []B ,
5
+ };
6
+ const B = struct {
7
+ a_pointer : * const A ,
8
+ };
9
+
10
+ const b_list : []B = []B {};
11
+ const a = A { .b_list_pointer = & b_list };
12
+
13
+ test "segfault bug" {
14
+ const assert = std .debug .assert ;
15
+ const obj = B { .a_pointer = & a };
16
+ assert (obj .a_pointer == & a ); // this makes zig crash
17
+ }
18
+
19
+ const A2 = struct {
20
+ pointer : * B ,
21
+ };
22
+
23
+ pub const B2 = struct {
24
+ pointer_array : []* A2 ,
25
+ };
26
+
27
+ var b_value = B2 { .pointer_array = []* A2 {} };
28
+
29
+ test "basic stuff" {
30
+ std .debug .assert (& b_value == & b_value );
31
+ }
You can’t perform that action at this time.
0 commit comments