mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 13:58:27 +00:00
parent
4d50bc3f8d
commit
6a9c32f759
@ -20,6 +20,7 @@ comptime {
|
||||
_ = @import("behavior/bugs/1486.zig");
|
||||
_ = @import("behavior/bugs/1500.zig");
|
||||
_ = @import("behavior/bugs/1851.zig");
|
||||
_ = @import("behavior/bugs/1914.zig");
|
||||
_ = @import("behavior/bugs/2006.zig");
|
||||
_ = @import("behavior/bugs/394.zig");
|
||||
_ = @import("behavior/bugs/421.zig");
|
||||
|
||||
31
test/stage1/behavior/bugs/1914.zig
Normal file
31
test/stage1/behavior/bugs/1914.zig
Normal file
@ -0,0 +1,31 @@
|
||||
const std = @import("std");
|
||||
|
||||
const A = struct {
|
||||
b_list_pointer: *const []B,
|
||||
};
|
||||
const B = struct {
|
||||
a_pointer: *const A,
|
||||
};
|
||||
|
||||
const b_list: []B = []B{};
|
||||
const a = A{ .b_list_pointer = &b_list };
|
||||
|
||||
test "segfault bug" {
|
||||
const assert = std.debug.assert;
|
||||
const obj = B{ .a_pointer = &a };
|
||||
assert(obj.a_pointer == &a); // this makes zig crash
|
||||
}
|
||||
|
||||
const A2 = struct {
|
||||
pointer: *B,
|
||||
};
|
||||
|
||||
pub const B2 = struct {
|
||||
pointer_array: []*A2,
|
||||
};
|
||||
|
||||
var b_value = B2{ .pointer_array = []*A2{} };
|
||||
|
||||
test "basic stuff" {
|
||||
std.debug.assert(&b_value == &b_value);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user