Last active
September 17, 2018 23:24
-
-
Save winksaville/61239d52598c334c2671f9183a359f82 to your computer and use it in GitHub Desktop.
Test ?*u0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = @import("std"); | |
const assert = std.debug.assert; | |
const warn = std.debug.warn; | |
const builtin = @import("builtin"); | |
const TypeId = builtin.TypeId; | |
test "u0" { | |
var zero: u0 = 0; | |
var pZeroOptional: ?*u0 = &zero; | |
assert(pZeroOptional != null); // this is true | |
assert(pZeroOptional == &zero);// And this is true | |
if (pZeroOptional != null) { | |
assert(pZeroOptional.?.* == 0); | |
} else { | |
unreachable; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment