mirror of
https://github.com/ziglang/zig.git
synced 2026-01-06 05:25:10 +00:00
parent
428a2fdedd
commit
c1fd7ed6e2
@ -23,6 +23,7 @@ comptime {
|
||||
_ = @import("behavior/bugs/1486.zig");
|
||||
_ = @import("behavior/bugs/1500.zig");
|
||||
_ = @import("behavior/bugs/1607.zig");
|
||||
_ = @import("behavior/bugs/1735.zig");
|
||||
_ = @import("behavior/bugs/1851.zig");
|
||||
_ = @import("behavior/bugs/1914.zig");
|
||||
_ = @import("behavior/bugs/2006.zig");
|
||||
|
||||
46
test/stage1/behavior/bugs/1735.zig
Normal file
46
test/stage1/behavior/bugs/1735.zig
Normal file
@ -0,0 +1,46 @@
|
||||
const std = @import("std");
|
||||
|
||||
const mystruct = struct {
|
||||
pending: ?listofstructs,
|
||||
};
|
||||
pub fn TailQueue(comptime T: type) type {
|
||||
return struct {
|
||||
const Self = @This();
|
||||
|
||||
pub const Node = struct {
|
||||
prev: ?*Node,
|
||||
next: ?*Node,
|
||||
data: T,
|
||||
};
|
||||
|
||||
first: ?*Node,
|
||||
last: ?*Node,
|
||||
len: usize,
|
||||
|
||||
pub fn init() Self {
|
||||
return Self{
|
||||
.first = null,
|
||||
.last = null,
|
||||
.len = 0,
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
const listofstructs = TailQueue(mystruct);
|
||||
|
||||
const a = struct {
|
||||
const Self = @This();
|
||||
|
||||
foo: listofstructs,
|
||||
|
||||
pub fn init() Self {
|
||||
return Self{
|
||||
.foo = listofstructs.init(),
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
test "intialization" {
|
||||
var t = a.init();
|
||||
std.testing.expect(t.foo.len == 0);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user