| author | |
| committer | |
| log | c1fd7ed6e2815b3317b4cb82ce85bf44149d7002 |
| tree | d269f7365be2f7343ee778605c212e540064cb1a |
| parent | 428a2fdedd1d2d9ce6c7a3b28a379e4484468b9c |
| signature |
closes #17352 files changed, 47 insertions(+), 0 deletions(-)
test/stage1/behavior.zig+1| ... | ... | @@ -23,6 +23,7 @@ comptime { |
| 23 | 23 | _ = @import("behavior/bugs/1486.zig"); |
| 24 | 24 | _ = @import("behavior/bugs/1500.zig"); |
| 25 | 25 | _ = @import("behavior/bugs/1607.zig"); |
| 26 | _ = @import("behavior/bugs/1735.zig"); | |
| 26 | 27 | _ = @import("behavior/bugs/1851.zig"); |
| 27 | 28 | _ = @import("behavior/bugs/1914.zig"); |
| 28 | 29 | _ = @import("behavior/bugs/2006.zig"); |
test/stage1/behavior/bugs/1735.zig created+46| ... | ... | @@ -0,0 +1,46 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | const mystruct = struct { | |
| 4 | pending: ?listofstructs, | |
| 5 | }; | |
| 6 | pub fn TailQueue(comptime T: type) type { | |
| 7 | return struct { | |
| 8 | const Self = @This(); | |
| 9 | ||
| 10 | pub const Node = struct { | |
| 11 | prev: ?*Node, | |
| 12 | next: ?*Node, | |
| 13 | data: T, | |
| 14 | }; | |
| 15 | ||
| 16 | first: ?*Node, | |
| 17 | last: ?*Node, | |
| 18 | len: usize, | |
| 19 | ||
| 20 | pub fn init() Self { | |
| 21 | return Self{ | |
| 22 | .first = null, | |
| 23 | .last = null, | |
| 24 | .len = 0, | |
| 25 | }; | |
| 26 | } | |
| 27 | }; | |
| 28 | } | |
| 29 | const listofstructs = TailQueue(mystruct); | |
| 30 | ||
| 31 | const a = struct { | |
| 32 | const Self = @This(); | |
| 33 | ||
| 34 | foo: listofstructs, | |
| 35 | ||
| 36 | pub fn init() Self { | |
| 37 | return Self{ | |
| 38 | .foo = listofstructs.init(), | |
| 39 | }; | |
| 40 | } | |
| 41 | }; | |
| 42 | ||
| 43 | test "intialization" { | |
| 44 | var t = a.init(); | |
| 45 | std.testing.expect(t.foo.len == 0); | |
| 46 | } |