Created
May 9, 2019 20:25
-
-
Save donpdonp/5564ed40e287cec345b7b855af340dff to your computer and use it in GitHub Desktop.
This file contains 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
donp@jewel 1off $ cat main.zig | |
pub const Command = struct { | |
id: u16, | |
payload: union { | |
a: u16, | |
b: u16 | |
} | |
}; | |
pub fn main() void { | |
const myCommand = Command{.id = 1, | |
.payload = @typeOf(@field(Command, "payload")){.a = 1}}; | |
} | |
donp@jewel 1off $ zig build-exe main.zig | |
/home/donp/code/tootdeck/zig/1off/main.zig:11:48: error: container 'Command' has no member called 'payload' | |
.payload = @typeOf(@field(Command, "payload")){.a = 1}}; | |
^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment