zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

test_comptime_wrong_union_field_access.zig (191B) - Raw


      1 comptime {
      2     var f = Foo{ .int = 42 };
      3     f.float = 12.34;
      4 }
      5 
      6 const Foo = union {
      7     float: f32,
      8     int: u32,
      9 };
     10 
     11 // test_error=access of union field 'float' while field 'int' is active