| ... | @@ -778,3 +778,11 @@ test "pointers to elements of many-ptr to zero-bit type" { | ... | @@ -778,3 +778,11 @@ test "pointers to elements of many-ptr to zero-bit type" { |
| 778 | | 778 | |
| 779 | try expect(a == b); | 779 | try expect(a == b); |
| 780 | } | 780 | } |
| | 781 | |
| | 782 | test "comptime C pointer to optional pointer" { |
| | 783 | const opt: ?*u8 = @ptrFromInt(0x1000); |
| | 784 | const outer_ptr: [*c]const ?*u8 = &opt; |
| | 785 | const inner_ptr = &outer_ptr.*.?; |
| | 786 | comptime assert(@TypeOf(inner_ptr) == [*c]const *u8); |
| | 787 | comptime assert(@intFromPtr(inner_ptr.*) == 0x1000); |
| | 788 | } |