mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
16 lines
510 B
Zig
16 lines
510 B
Zig
comptime {
|
|
@Struct(.auto, null, &.{"foo"}, &.{u32}, &.{.{ .@"comptime" = true }});
|
|
}
|
|
comptime {
|
|
@Struct(.@"extern", null, &.{"foo"}, &.{u32}, &.{.{ .@"comptime" = true, .default_value_ptr = &@as(u32, 10) }});
|
|
}
|
|
comptime {
|
|
@Struct(.@"packed", null, &.{"foo"}, &.{u32}, &.{.{ .@"align" = 4 }});
|
|
}
|
|
|
|
// error
|
|
//
|
|
// :2:46: error: comptime field without default initialization value
|
|
// :5:51: error: extern struct fields cannot be marked comptime
|
|
// :8:51: error: packed struct fields cannot be aligned
|
|
|